summaryrefslogtreecommitdiffstats
path: root/storage/udev.py
diff options
context:
space:
mode:
authorJoel Granados Moreno <jgranado@redhat.com>2009-03-05 18:10:16 +0100
committerJoel Granados Moreno <jgranado@redhat.com>2009-03-06 16:18:04 +0100
commit7b3a73f1018efad6f8a640dd61f8cc5a7571f69d (patch)
treeb9755a06138d1271c8779c62c889eece943ae9b6 /storage/udev.py
parent0b65aca74899a558d14d1e305bb98380be185dfc (diff)
downloadanaconda-7b3a73f1018efad6f8a640dd61f8cc5a7571f69d.tar.gz
anaconda-7b3a73f1018efad6f8a640dd61f8cc5a7571f69d.tar.xz
anaconda-7b3a73f1018efad6f8a640dd61f8cc5a7571f69d.zip
Add dmraid functionality to new storage code.
* storage/devices.py (DMRaidArrayDevice): Complete the DMRaidArrayDevice class. * storage/devices.py (PartitionDeviceFactory): When creating a partition we need to decide, based on the device holding the partition, what type of partition class will be returned. * storage/devices.py (PartitionDevice): When setting the disk we must be careful to change stuff accordingly. * storage/devicetree.py (addUdevDevice): Handle the creation of the dmraid device and its members in the addUdeveDevice function. * storage/formats/dmraid.py (DMRaidMember): Complete the format that handles devices being members of a dmraid array. * storage/udev.py (udev_device_is_dmraid): add a function that recognizes dmraid devices from the provided info list. * storage/udev.py (udev_device_get_dmraid_partition_disk): function that gets the disk string from partition info. * storage/udev.py (udev_device_is_dmraid_partition): function that checks for dmraid partitions. * storage/__init__.py (disks(self)): return a list of disks from the internal attribute. * storage/__init__.py (Storage.disks): we really want to make sure we return all the objects that comply with the DiskDevice interface (inheret from DiskDevice) * storage/__init__.py (Storage.partitions): Same as above but for PartitionDevice. * iw/autopart_type (PartitionTypeWindow(InstallWindow)): use disk.name instead of munging the first 5 characters of the path. * storage/partitioning (newPartition): Use the new partition factory to create a partition.
Diffstat (limited to 'storage/udev.py')
-rw-r--r--storage/udev.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/storage/udev.py b/storage/udev.py
index 6df00c855..a39b98c81 100644
--- a/storage/udev.py
+++ b/storage/udev.py
@@ -270,4 +270,37 @@ def udev_device_get_lv_sizes(info):
return [float(s) / 1024 for s in sizes]
+def udev_device_is_dmraid(info):
+ # Note that this function does *not* identify raid sets.
+ # Tests to see if device is parto of a dmraid set.
+ # dmraid and mdriad have the same ID_FS_USAGE string, ID_FS_TYPE has a
+ # string that describes the type of dmraid (isw_raid_member...), I don't
+ # want to maintain a list and mdraid's ID_FS_TYPE='linux_raid_member', so
+ # dmraid will be everything that is raid and not linux_raid_member
+ if info.has_key("ID_FS_USAGE") and info.has_key("ID_FS_TYPE") and \
+ info["ID_FS_USAGE"] == "raid" and \
+ info["ID_FS_TYPE"] != "linux_raid_member":
+ return True
+
+ return False
+
+def udev_device_get_dmraid_partition_disk(info):
+ try:
+ p_index = info["DM_NAME"].rindex("p")
+ except:
+ return None
+
+ if not info["DM_NAME"][p_index+1:].isdigit():
+ return None
+
+ return info["DM_NAME"][:p_index]
+
+def udev_device_is_dmraid_partition(info, devicetree):
+ diskname = udev_device_get_dmraid_partition_disk(info)
+ dmraid_devices = devicetree.getDevicesByType("dm-raid array")
+
+ for device in dmraid_devices:
+ if diskname == device.name:
+ return True
+ return False