[PATCH 4/4] Fix upgrade of GRUB with md raid boot for versions F11 and earlier.

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

 



Up to F11 /dev/mdX in /etc/sysconfig/grub means that grub was installed into
mbrs of all /boot md device members' disks. When upgrading grub of such a
system, reinstall grub in the mbrs, and update values sysconfig file
accordingly (to hold e.g. /dev/sda). Here I'm not completly sure. What if after
installation the user reinstalled grub manually - restored mbrs and installed
it in /dev/mdX?  He wouldn't be happy with our grub update then...

This is one of follow-up commits for commit
358a9a34f496fdd2b032edf12274a146b606d1a4, dealing with upgrade.
---
 bootloader.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/bootloader.py b/bootloader.py
index 54a37b5..729fe2c 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -29,6 +29,8 @@ import string
 from flags import flags
 from constants import *
 from storage.devices import devicePathToName
+from storage import getReleaseString
+from booty.util import getDiskPart
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -115,6 +117,22 @@ def bootloaderSetupChoices(anaconda):
     elif choices and choices.has_key("boot"):
         anaconda.id.bootloader.setDevice(choices["boot"][0])
 
+def fixedMdraidGrubTarget(anaconda, grubTarget):
+    # handle change made in F12 - before F12 mdX used to mean installation
+    # into mbrs of mdX members' disks
+    fixedGrubTarget = grubTarget
+    (product, version) = getReleaseString(anaconda.rootPath)
+    try:
+        if float(version) < 12:
+            stage1Devs = anaconda.id.bootloader.getPhysicalDevices(grubTarget)
+            fixedGrubTarget = getDiskPart(stage1Devs[0], anaconda.id.storage)[0]
+            log.info("Mdraid grub upgrade: %s -> %s" % (grubTarget,
+                                                       fixedGrubTarget))
+    except ValueError:
+        log.warning("Can't decide mdraid grub upgrade fix, product: %s, version: %s" % (product, version))
+
+    return fixedGrubTarget
+
 def writeBootloader(anaconda):
     def dosync():
         isys.sync()
@@ -131,6 +149,9 @@ def writeBootloader(anaconda):
         
         anaconda.id.bootloader.doUpgradeonly = 1
         if bootType == "GRUB":
+            if theDev.startswith('/dev/md'):
+                theDev = fixedMdraidGrubTarget(anaconda,
+                                               devicePathToName(theDev))
             anaconda.id.bootloader.useGrubVal = 1
             anaconda.id.bootloader.setDevice(devicePathToName(theDev))
         else:
-- 
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