[master 2/2] Use raid RAID level constants instead of mdraid RAID level constants.

mulhern amulhern at redhat.com
Tue Nov 26 18:37:12 UTC 2013


raid RAID level constants are singleton objects, not integers.
In future, there may some RAID levels used here that do not have numbers
associated with them, so this is a good change.
List inclusion should work the same, and string formatting is slightly
simpler.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 pyanaconda/bootloader.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 51f7f24..f26cef2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -28,7 +28,7 @@ import struct
 from parted import PARTITION_BIOS_GRUB
 
 from pyanaconda import iutil
-from blivet.devicelibs import mdraid
+from blivet.devicelibs import raid
 from pyanaconda.isys import sync
 from pyanaconda.product import productName
 from pyanaconda.flags import flags
@@ -394,7 +394,7 @@ class BootLoader(object):
             return ret
 
         if raid_levels and device.level not in raid_levels:
-            levels_str = ",".join("RAID%d" % l for l in raid_levels)
+            levels_str = ",".join("%s" % l for l in raid_levels)
             self.errors.append(_("RAID sets that contain '%(desc)s' must have one "
                                  "of the following raid levels: %(raid_level)s.")
                                  % {"desc" : desc, "raid_level" : levels_str})
@@ -973,7 +973,7 @@ class GRUB(BootLoader):
 
     # list of strings representing options for boot device types
     stage2_device_types = ["partition", "mdarray"]
-    stage2_raid_levels = [mdraid.RAID1]
+    stage2_raid_levels = [raid.RAID1]
     stage2_raid_member_types = ["partition"]
     stage2_raid_metadata = ["0", "0.90", "1.0"]
 
@@ -1351,8 +1351,8 @@ class GRUB2(GRUB):
     # requirements for boot devices
     stage2_device_types = ["partition", "mdarray", "lvmlv", "btrfs volume",
                            "btrfs subvolume"]
-    stage2_raid_levels = [mdraid.RAID0, mdraid.RAID1, mdraid.RAID4,
-                          mdraid.RAID5, mdraid.RAID6, mdraid.RAID10]
+    stage2_raid_levels = [raid.RAID0, raid.RAID1, raid.RAID4,
+                          raid.RAID5, raid.RAID6, raid.RAID10]
     stage2_raid_metadata = ["0", "0.90", "1.0", "1.2"]
 
     @property
@@ -1780,7 +1780,7 @@ class Yaboot(YabootBase):
 
     # stage2 device requirements
     stage2_device_types = ["partition", "mdarray"]
-    stage2_device_raid_levels = [mdraid.RAID1]
+    stage2_device_raid_levels = [raid.RAID1]
 
     #
     # configuration
@@ -2011,7 +2011,7 @@ class ZIPL(BootLoader):
 
     # stage2 device requirements
     stage2_device_types = ["partition", "mdarray", "lvmlv"]
-    stage2_device_raid_levels = [mdraid.RAID1]
+    stage2_device_raid_levels = [raid.RAID1]
 
     @property
     def stage2_format_types(self):
-- 
1.8.3.1



More information about the anaconda-patches mailing list