[PATCH 1/2] Set target of grub stage1 properly for boot on md raid 1 device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hans de Goede <hdegoede@xxxxxxxxxx>

Use type of device rather than name in target selection. Type of intel
bios raid using mdraid is "disk".
---
 booty/x86.py |   42 ++++++++++++++++--------------------------
 1 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/booty/x86.py b/booty/x86.py
index 3890e69..43d3f0e 100644
--- a/booty/x86.py
+++ b/booty/x86.py
@@ -43,7 +43,8 @@ class x86BootloaderInfo(efiBootloaderInfo):
         # Accepted values for "device" are raid1 md devices (i.e. "md0"),
         # physical disks ("hda"), and real partitions on physical disks
         # ("hda1").  Volume groups/logical volumes are not accepted.
-        path = self.storage.devicetree.getDeviceByName(device).path[5:]
+        dev = self.storage.devicetree.getDeviceByName(device)
+        path = dev.path[5:]
 
         if device in map (lambda x: x.name, self.storage.lvs + self.storage.vgs):
             return []
@@ -51,16 +52,12 @@ class x86BootloaderInfo(efiBootloaderInfo):
         if path.startswith("mapper/luks-"):
             return []
 
-
-        if path.startswith('md'):
-            if flags.cmdline.has_key("iswmd"):
-                return [device]
-            else:
-                bootable = 0
-                parts = checkbootloader.getRaidDisks(device, self.storage,
-                                                 raidLevel=1, stripPart=0)
-                parts.sort()
-                return parts
+        if dev.type == "mdarray":
+            bootable = 0
+            parts = checkbootloader.getRaidDisks(device, self.storage,
+                                             raidLevel=1, stripPart=0)
+            parts.sort()
+            return parts
 
         return [device]
 
@@ -145,18 +142,12 @@ class x86BootloaderInfo(efiBootloaderInfo):
             os.rename(cf, cf + '.rpmsave')
 
         grubTarget = bl.getDevice()
-        path = self.storage.devicetree.getDeviceByName(grubTarget).path[5:]
-        target = "mbr"
-        if (path.startswith('rd/') or path.startswith('ida/') or
-                path.startswith('cciss/') or
-                path.startswith('sx8/') or
-                path.startswith('mapper/')):
-            if grubTarget[-1].isdigit():
-                if grubTarget[-2] == 'p' or \
-                        (grubTarget[-2].isdigit() and grubTarget[-3] == 'p'):
-                    target = "partition"
-        elif grubTarget[-1].isdigit() and not path.startswith('md'):
+        targetDevice = self.storage.devicetree.getDeviceByName(grubTarget)
+        path = targetDevice.path[5:]
+        if targetDevice.type == "partition" or targetDevice.type == "mdarray":
             target = "partition"
+        else:
+            target = "mbr"
 
         f = open(cf, "w+")
 
@@ -335,10 +326,9 @@ class x86BootloaderInfo(efiBootloaderInfo):
         for drive in devs:
             # XXX hack city.  If they're not the sort of thing that'll
             # be in the device map, they shouldn't still be in the list.
-            path = self.storage.devicetree.getDeviceByName(drive).path
-            if ((drive.startswith('md') and flags.cmdline.has_key("iswmd")) or
-                not drive.startswith('md')):
-                    f.write("(%s)     %s\n" % (self.grubbyDiskName(drive), path))
+            dev = self.storage.devicetree.getDeviceByName(drive)
+            if not dev.type == "mdarray":
+                f.write("(%s)     %s\n" % (self.grubbyDiskName(drive), dev.path))
         f.close()
 
         sysconf = '/etc/sysconfig/grub'
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux