From: Martin Gracik <mgracik@xxxxxxxxxx> Do not list the directories in sys, but use the libudev's enumerate_devices function to get the sysfs paths. Run /sbin/udevadm rather than just udevadm to ensure baseudev.py in an updates.img works. --- baseudev.py | 20 +++++--------------- 1 files changed, 5 insertions(+), 15 deletions(-) diff --git a/baseudev.py b/baseudev.py index 0eb66b8..8a23825 100644 --- a/baseudev.py +++ b/baseudev.py @@ -31,24 +31,14 @@ import logging log = logging.getLogger("storage") def udev_enumerate_devices(deviceClass="block"): - top_dir = "/sys/class/%s" % deviceClass - devices = [] - for dev_name in os.listdir(top_dir): - full_path = os.path.join(top_dir, dev_name) - link_ref = os.readlink(full_path) - real_path = os.path.join(top_dir, link_ref) - sysfs_path = os.path.normpath(real_path) - devices.append(sysfs_path[4:]) - return devices + return global_udev.enumerate_devices(subsystem=deviceClass) def udev_get_device(sysfs_path): - if not os.path.exists("/sys%s" % sysfs_path): + if not os.path.exists(sysfs_path): log.debug("%s does not exist" % sysfs_path) return None - # XXX we remove the /sys part when enumerating devices, - # so we have to prepend it when creating the device - dev = global_udev.create_device("/sys" + sysfs_path) + dev = global_udev.create_device(sysfs_path) if dev: dev["name"] = dev.sysname @@ -90,11 +80,11 @@ def udev_settle(): # lots of disks, or with slow disks argv = ["settle", "--timeout=300"] - iutil.execWithRedirect("udevadm", argv, stderr="/dev/null") + iutil.execWithRedirect("/sbin/udevadm", argv, stderr="/dev/null") def udev_trigger(subsystem=None, action="add"): argv = ["trigger", "--action=%s" % action] if subsystem: argv.append("--subsystem-match=%s" % subsystem) - iutil.execWithRedirect("udevadm", argv, stderr="/dev/null") + iutil.execWithRedirect("/sbin/udevadm", argv, stderr="/dev/null") -- 1.6.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list