[rhel6-branch] Fix bootloader issues on s390x. (#875644, #894050, #1008941)

Samantha N. Bueno sbueno+anaconda at redhat.com
Fri Oct 4 14:03:48 UTC 2013


These patches should add proper support for s390/x upgrades now, and
also clean up some of the s390/x bootloader code in the process--e.g.
there is no need to re-write zipl.conf if you are just doing an
upgrade since new-kernel-pkg should take care of adding new entries
properly.

Resolves: rhbz#875644
Resolves: rhbz#894050
Resolves: rhbz#1008941
---
 bootloader.py           |  3 +--
 booty/bootloaderInfo.py |  1 +
 booty/s390.py           | 54 ++++++++++++++++++++++++++++++++++++-------------
 3 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/bootloader.py b/bootloader.py
index 52f8ef7..6d850b8 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -173,9 +173,8 @@ def writeBootloader(anaconda):
             anaconda.id.bootloader.setDevice(devicePathToName(theDev))
         elif bootType == "ZIPL":
             anaconda.id.bootloader.images.setup(anaconda.id.storage)
-            return
         else:
-            anaconda.id.bootloader.doUpgradeOnly = 0    
+            anaconda.id.bootloader.doUpgradeOnly = 0
             anaconda.id.bootloader.images.setup(anaconda.id.storage)
 
     w = anaconda.intf.waitWindow(_("Bootloader"), _("Installing bootloader."))
diff --git a/booty/bootloaderInfo.py b/booty/bootloaderInfo.py
index a3d96bf..eb6bee6 100644
--- a/booty/bootloaderInfo.py
+++ b/booty/bootloaderInfo.py
@@ -595,6 +595,7 @@ class bootloaderInfo(object):
         # "install" case.  if 1, update lilo.conf (since grubby won't do that)
         # and then run lilo or grub only.
         # XXX THIS IS A HACK.  implementation details are only there for x86
+        # and as of 2013, for s390/s390x as well.
         self.doUpgradeOnly = 0
         self.kickstart = 0
 
diff --git a/booty/s390.py b/booty/s390.py
index c237b5a..1761d34 100644
--- a/booty/s390.py
+++ b/booty/s390.py
@@ -116,9 +116,25 @@ class s390BootloaderInfo(bootloaderInfo):
         
     
     def writeZipl(self, instRoot, bl, kernelList, chainList,
-                  defaultDev, justConfigFile):
+                  defaultDev, upgrade=False):
         rootDev = self.storage.rootDevice
-        
+
+        try:
+            bootDev = self.storage.mountpoints["/boot"]
+        except KeyError:
+            bootDev = rootDev
+
+        if not upgrade:
+            self.writeZiplConf(instRoot, bl, kernelList, chainList, defaultDev,
+                                rootDev, not self.useZiplVal)
+        else:
+            # at this point all we should have to do is set the boot device
+            # if all we are doing is upgrading
+            self.prepBootDev(instRoot)
+
+
+    def writeZiplConf(self, instRoot, bl, kernelList, chainList,
+                  defaultDev, rootDev, justConfigFile):
         cf = '/etc/zipl.conf'
         self.perms = 0600
         if os.access (instRoot + cf, os.R_OK):
@@ -155,23 +171,33 @@ class s390BootloaderInfo(bootloaderInfo):
         f.close()
 
         if not justConfigFile:
-            rc = iutil.execWithCapture("zipl", [], root = instRoot,
-                                       stderr = "/dev/stderr",
-                                       fatal = True)
-            for line in rc.splitlines():
-                if line.startswith("Preparing boot device: "):
-                    # Output here may look like:
-                    #     Preparing boot device: dasdb (0200).
-                    #     Preparing boot device: dasdl.
-                    # We want to extract the device name and pass that.
-
-                    fields = line[23:].split()
-                    self.setDevice(fields[0].replace('.', ''))
+            self.prepBootDev(instRoot)
 
         return 0
 
+    def prepBootDev(self, instRoot):
+        rc = iutil.execWithCapture("zipl", [], root = instRoot,
+                                   stderr = "/dev/stderr",
+                                   fatal = True)
+        for line in rc.splitlines():
+            if line.startswith("Preparing boot device: "):
+                # Output here may look like:
+                #     Preparing boot device: dasdb (0200).
+                #     Preparing boot device: dasdl.
+                # We want to extract the device name and pass that.
+
+                fields = line[23:].split()
+                self.setDevice(fields[0].replace('.', ''))
+        return
+
+
     def write(self, instRoot, bl, kernelList, chainList,
             defaultDev):
+        if self.doUpgradeOnly:
+            return self.writeZipl(instRoot, bl, kernelList,
+                                    chainList, defaultDev,
+                                    upgrade=True)
+
         rc = self.writeZipl(instRoot, bl, kernelList, 
                             chainList, defaultDev,
                             not self.useZiplVal)
-- 
1.8.3.1



More information about the anaconda-patches mailing list