Expand the DASDDevice class to hold the device bus ID and flags that are passed at boot time. Add udev functions to return the bus ID and flag values for DASD devices. When building the device tree, read the DASD information and pass that to the DASDDevice object. --- storage/devices.py | 12 +++++++----- storage/devicetree.py | 5 +++++ storage/udev.py | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index 6ed2c79..a37834f 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -3151,11 +3151,13 @@ class DASDDevice(DiskDevice): _type = "dasd" _forceDracut = True - def __init__(self, device, size=None, major=None, minor=None, - parents=None, sysfsPath=''): - DiskDevice.__init__(self, device, size=size, - major=major, minor=minor, - parents=parents, sysfsPath=sysfsPath) + def __init__(self, *args, **kwargs): + self.busid = kwargs.get('busid') + self.readonly = kwargs.get('readonly') + self.diag = kwargs.get('diag') + self.erplog = kwargs.get('erplog') + self.failfast = kwargs.get('failfast') + DiskDevice.__init__(self, *args, **kwargs) class NFSDevice(StorageDevice, NetworkStorageDevice): diff --git a/storage/devicetree.py b/storage/devicetree.py index d355804..5c19e72 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1192,6 +1192,11 @@ class DeviceTree(object): kwargs["exists"] = True elif udev_device_is_dasd(info): diskType = DASDDevice + kwargs["busid"] = udev_device_get_dasd_bus_id(info) + kwargs["readonly"] = udev_device_get_dasd_flag(info, "readonly") + kwargs["diag"] = udev_device_get_dasd_flag(info, "diag") + kwargs["erplog"] = udev_device_get_dasd_flag(info, "erplog") + kwargs["failfast"] = udev_device_get_dasd_flag(info, "failfast") log.debug("%s is a dasd device" % name) else: diskType = DiskDevice diff --git a/storage/udev.py b/storage/udev.py index d051157..bbaa977 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -165,6 +165,21 @@ def udev_device_is_dasd(info): else: return False +def udev_device_get_dasd_bus_id(info): + """ Return the CCW bus ID of the dasd device. """ + return info.get("ID_PATH").split('-')[2] + +def udev_device_get_dasd_flag(info, flag=None): + """ Return the specified flag for the dasd device. """ + if flag is None: + return None + + path = "/sys" + info.get("sysfs_path") + "/device/" + flag + if not os.path.isfile(path): + return None + + return bool(open(path, 'r').read().strip()) + def udev_device_is_cdrom(info): """ Return True if the device is an optical drive. """ # FIXME: how can we differentiate USB drives from CD-ROM drives? -- 1.6.2.5 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list