[anaconda][rhel6-branch] Properly check and show warnings for LDL DASDs (#1144979)

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Jan 20 19:57:45 UTC 2015


My former patch for this (d8e96265) added unformatted DASDs and LDL
DASDs to the same list of disks needing dasdfmt.

Unfortunately, this means if you enter "zerombr" in your ks file, LDL
DASDs will have dasdfmt run against them, even if you only wanted
unformatted DASDs to be formatted. Since users probably won't (a) expect
or (b) want this behavior, we should maintain two separate lists. A new
pykickstart --cdl option can be checked in order to determine whether or
not to dasdfmt any LDL DASDs.

(No, this isn't complicated or anything.)

Resolves: rhbz#1144979
---
 storage/dasd.py | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/storage/dasd.py b/storage/dasd.py
index 1576048..5c197da 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -46,6 +46,7 @@ class DASD:
 
     def __init__(self):
         self._dasdlist = []
+        self._ldldasdlist = []
         self._devices = []                  # list of DASDDevice objects
         self.totalCylinders = 0
         self._completedCylinders = 0.0
@@ -68,8 +69,6 @@ class DASD:
             return
 
         self.started = True
-        out = "/dev/tty5"
-        err = "/dev/tty5"
 
         if not iutil.isS390():
             return
@@ -104,11 +103,7 @@ class DASD:
             elif isys.isLdlDasd(device):
                 log.info("     %s (%s) is an LDL DASD, needs dasdfmt" % (device,
                                                                          bypath))
-                self._dasdlist.append((device, bypath))
-
-        if not len(self._dasdlist):
-            log.info("    no unformatted or LDL DASD devices found")
-            return
+                self._ldldasdlist.append((device, bypath))
 
         askUser = True
 
@@ -119,11 +114,27 @@ class DASD:
                      "command, unable to run dasdfmt, exiting installer")
             sys.exit(0)
 
-        c = len(self._dasdlist)
+        # now onto formatting our DASDs
+        if not len(self._dasdlist):
+            log.info("    no unformatted DASD devices found")
+        else:
+            self.format_dasds(intf, askUser, self._dasdlist)
+
+        if not len(self._ldldasdlist):
+            log.info("    no LDL DASD devices found")
+        else:
+            self.format_dasds(intf, askUser, self._ldldasdlist)
+
+    def format_dasds(self, intf, askUser, dasdlist):
+        """ Iterate through a given list of DASDs and run dasdfmt on them. """
+        out = "/dev/tty5"
+        err = "/dev/tty5"
+
+        c = len(dasdlist)
 
         if intf and askUser:
             devs = ''
-            for dasd, bypath in self._dasdlist:
+            for dasd, bypath in dasdlist:
                 devs += "%s\n" % (bypath,)
 
             rc = intf.questionInitializeDASD(c, devs)
@@ -133,7 +144,7 @@ class DASD:
 
         # gather total cylinder count
         argv = ["-t", "-v"] + self.commonArgv
-        for dasd, bypath in self._dasdlist:
+        for dasd, bypath in dasdlist:
             buf = iutil.execWithCapture(self.dasdfmt, argv + ["/dev/" + dasd],
                                         stderr=err)
             for line in buf.splitlines():
@@ -158,7 +169,7 @@ class DASD:
             else:
                 pw = intf.progressWindow(title, msg, 100, pulse=True)
 
-        for dasd, bypath in self._dasdlist:
+        for dasd, bypath in dasdlist:
             log.info("Running dasdfmt on %s" % (bypath,))
             arglist = argv + ["/dev/" + dasd]
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list