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

Samantha N. Bueno sbueno+anaconda at redhat.com
Thu Jan 15 18:59:01 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 | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/storage/dasd.py b/storage/dasd.py
index 1576048..10fbc58 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
@@ -104,11 +105,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 +116,26 @@ 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")
+            return
+        else:
+            self.format_dasds(intf, askUser, self._dasdlist)
+
+        if not len(self._ldldasdlist):
+            log.info("    no LDL DASD devices found")
+            return
+        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. """
+        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 +145,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 +170,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]
 
@@ -184,6 +196,7 @@ class DASD:
 
         if intf:
             pw.pop()
+        return
 
     def addDASD(self, dasd):
         """ Adds a DASDDevice to the internal list of DASDs. """
-- 
1.8.3.1



More information about the anaconda-patches mailing list