[master/rhel7] Don't add redundant grub installs if stage1 is not on a RAID

David Shea dshea at redhat.com
Thu Jan 16 19:09:07 UTC 2014


This broke the case where stage1 is a partition such as prepboot or
biosboot that must be installed to a particular standard partition, and
/boot is on a RAID1. If we encounter such a case, assume that stage1
should be left as it is and let the RAID take care of the stage2
redundancy.

Resolves: rhbz#1035720
---
 pyanaconda/bootloader.py | 38 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 22 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 4127dbf..2a628b2 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1267,30 +1267,24 @@ class GRUB(BootLoader):
     def install_targets(self):
         """ List of (stage1, stage2) tuples representing install targets. """
         targets = []
+
+        # make sure we have stage1 and stage2 installed with redundancy
+        # so that boot can succeed even in the event of failure or removal
+        # of some of the disks containing the member partitions of the
+        # /boot array. If the stage1 is not a disk, it probably needs to
+        # be a partition on a particular disk (biosboot, prepboot), so only
+        # add the redundant targets if installing stage1 to a disk that is
+        # a member of the stage2 array.
+
         if self.stage2_device.type == "mdarray" and \
-           self.stage2_device.level == 1:
-            # make sure we have stage1 and stage2 installed with redundancy
-            # so that boot can succeed even in the event of failure or removal
-            # of some of the disks containing the member partitions of the
-            # /boot array
+           self.stage2_device.level == 1 and \
+           self.stage1_device.isDisk and \
+           self.stage2_device.dependsOn(self.stage1_device):
             for stage2dev in self.stage2_device.parents:
-                if self.stage1_device.isDisk:
-                    # install to mbr
-                    if self.stage2_device.dependsOn(self.stage1_device):
-                        # if target disk contains any of /boot array's member
-                        # partitions, set up stage1 on each member's disk
-                        # and stage2 on each member partition
-                        stage1dev = stage2dev.disk
-                    else:
-                        # if target disk does not contain any of /boot array's
-                        # member partitions, install stage1 to the target disk
-                        # and stage2 to each of the member partitions
-                        stage1dev = self.stage1_device
-                else:
-                    # target is /boot device and /boot is raid, so install
-                    # grub to each of /boot member partitions
-                    stage1dev = stage2dev
-
+                # if target disk contains any of /boot array's member
+                # partitions, set up stage1 on each member's disk
+                # and stage2 on each member partition
+                stage1dev = stage2dev.disk
                 targets.append((stage1dev, stage2dev))
         else:
             targets.append((self.stage1_device, self.stage2_device))
-- 
1.8.4.2



More information about the anaconda-patches mailing list