summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Vykydal <rvykydal@redhat.com>2009-10-16 16:30:05 +0200
committerRadek Vykydal <rvykydal@redhat.com>2009-10-29 14:26:00 +0100
commit8a99c19e8f2c52dcc69e35c4917ce533e0a9f926 (patch)
tree90e4064ea808bbe3ae45180ee631778266e00a05
parent558abca4d3f6740eadba96ead716839440112759 (diff)
Fix upgrade of GRUB with md raid boot for versions F11 and earlier.
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.
-rw-r--r--bootloader.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/bootloader.py b/bootloader.py
index 54a37b580..729fe2ca9 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: