diff options
author | David Cantrell <dcantrell@redhat.com> | 2009-10-12 10:57:30 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2009-10-15 16:27:49 -1000 |
commit | 5372bf1e34bf63bc15bb761447dc56585283082b (patch) | |
tree | ed9ac745ac7c83d21f13e5115a96853dab35d4bb /storage | |
parent | afde152b88a270ce5db3057a385be1bfff491631 (diff) | |
download | anaconda-5372bf1e34bf63bc15bb761447dc56585283082b.tar.gz anaconda-5372bf1e34bf63bc15bb761447dc56585283082b.tar.xz anaconda-5372bf1e34bf63bc15bb761447dc56585283082b.zip |
Collect DASD kernel parameter information during device tree scan (#526354).
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.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/devices.py | 9 | ||||
-rw-r--r-- | storage/devicetree.py | 6 | ||||
-rw-r--r-- | storage/udev.py | 15 |
3 files changed, 25 insertions, 5 deletions
diff --git a/storage/devices.py b/storage/devices.py index 9166b6cf6..27cb50121 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -3158,11 +3158,10 @@ class DASDDevice(DiskDevice): """ A mainframe DASD. """ _type = "dasd" - 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, device, **kwargs): + self.busid = kwargs.get('busid') + self.opts = kwargs.get('opts') + DiskDevice.__init__(self, device, kwargs) class NFSDevice(StorageDevice, NetworkStorageDevice): diff --git a/storage/devicetree.py b/storage/devicetree.py index d117f4c79..dfea37d89 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1192,6 +1192,12 @@ class DeviceTree(object): kwargs["exists"] = True elif udev_device_is_dasd(info): diskType = DASDDevice + kwargs["busid"] = udev_device_get_dasd_bus_id(info) + kwargs["opts"] = {} + + for attr in ['readonly', 'use_diag', 'erplog', 'failfast']: + kwargs["opts"][attr] = udev_device_get_dasd_flag(info, attr) + log.debug("%s is a dasd device" % name) elif udev_device_is_zfcp(info): diskType = ZFCPDiskDevice diff --git a/storage/udev.py b/storage/udev.py index bd89007bc..c4bce6e0d 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -207,6 +207,21 @@ def udev_device_get_zfcp_attribute(info, attr=None): return open(attribute, "r").read().strip() +def udev_device_get_dasd_bus_id(info): + """ Return the CCW bus ID of the dasd device. """ + return info.get("sysfs_path").split("/")[-3] + +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 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? |