Hi, See comments below On 07/01/2009 01:13 AM, David Lehman wrote:
This function resolves an arbitrary device specification (name, path, uuid, or label) to a device name. It returns None if there is a failure. --- storage/udev.py | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/storage/udev.py b/storage/udev.py index 5c17a34..ebd2f27 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -29,6 +29,27 @@ from errors import * import logging log = logging.getLogger("storage") +def udev_resolve_devspec(devspec): + if not devspec: + return None + + ret = None + for dev in udev_get_block_devices(): + if devspec.startswith("LABEL="): + if udev_device_get_label(dev) == devspec[6:]: + ret = dev + break + elif devspec.startswith("UUID="): + if udev_device_get_uuid(dev) == devspec[5:]: + ret = dev + break + else: + if udev_device_get_name(dev) == os.path.basename(devspec): + ret = dev + break +
I believe this should be: if udev_device_get_name(dev) == devices.devicePathToName(devspec): Or maybe we should try both ? What is for example the devspec for a cciss device is it cciss/c0d0p1 or just c0d0p1, the udev and devicetree name is cciss/c0d0p1, so if the devicespec can be a devicetree name we need to also compare to devices.devicePathToName(devspec):
+ if ret: + return udev_device_get_name(dev) def udev_get_block_devices(): udev_settle(timeout=30)
Regards, Hans _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list