Rather than scanning /dev/disk/by-path directly, check the udev database for the PATH_ID or ID_PATH or whatever it's called that gives us the devlink name that would appear in /dev/disk/by-path. Sometimes the links in /dev/disk/by-path do not appear because you have them already in /dev/disk/by-id (or not, who knows?). At any rate, stop checking the /dev/disk/by-path directory manually and just ask udev. Related: rhbz#560702 --- storage/devices.py | 24 ++++++------------------ 1 files changed, 6 insertions(+), 18 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index 399802b..5761d05 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -147,28 +147,16 @@ def devicePathToName(devicePath): def deviceNameToDiskByPath(deviceName=None): - bypath = '/dev/disk/by-path' - if not deviceName: return "" + else: + deviceName = os.path.basename(deviceName) - if not os.path.isdir(bypath): - return "" - - deviceName = os.path.basename(deviceName) - - for path in os.listdir(bypath): - entry = bypath + '/' + path - - if os.path.islink(entry): - target = os.path.basename(os.readlink(entry)) - else: - target = os.path.basename(entry) - - if target == deviceName: - return entry + for dev in udev_get_block_devices(): + if udev_device_get_name(dev) == deviceName: + return udev_device_get_path(dev) - return "" + return deviceName class Device(object): -- 1.6.6.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list