[PATCH] Use dasd_mod format for rd.dasd= content (#825256)

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

 



This change goes with dracut changes to consolidate syntax used for
rd.dasd=/rd_DASD=/DASD= dracut options.  The syntax used is the syntax
supported by the dasd_mod itself.
---
 pyanaconda/storage/devices.py |   40 ++++++++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 0d99324..9401074 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -3832,22 +3832,42 @@ class DASDDevice(DiskDevice):
     def dracutSetupArgs(self):
         conf = "/etc/dasd.conf"
         opts = {}
+        line = None
+        # Create a translation mapping from dasd.conf format to module format
+        translate = {'use_diag': 'diag',
+                     'readonly': 'ro',
+                     'erplog': 'erplog',
+                     'failfast': 'failfast'}
 
         if os.path.isfile(conf):
             f = open(conf)
-            lines = filter(lambda y: not y.startswith('#') and y != '',
-                           map(lambda x: x.strip(), f.readlines()))
+            # grab the first line that starts with our busID
+            line = [line for line in f.readlines()
+                    if line.startswith(self.busid)][:0]
             f.close()
 
-            for line in lines:
-                parts = line.split()
-                if parts != []:
-                    opts[parts[0]] = parts
-
-        if self.busid in opts.keys():
-            return set(["rd.dasd=%s" % ",".join(opts[self.busid])])
+        # See if we got a line.  If not, grab our getOpts
+        if not line:
+            line = self.busid
+            for devopt in self.getOpts():
+                line += " %s" % devopt
+
+        parts = line.split()
+        opts[self.busid] = []
+        # this is a really awkward way of determining if the
+        # feature found is actually desired (1, not 0), plus
+        # translating that feature into the actual kernel module
+        # value
+        for chunk in parts[1:]:
+            feat, val = chunk.split('=')
+            if int(val):
+                opts[self.busid].append(translate[feat])
+
+        if opts[self.busid]:
+            return set(["rd.dasd=%s(%s)" % (self.busid,
+                                            ":".join(opts[self.busid]))])
         else:
-            return set(["rd.dasd=%s" % ",".join([self.busid] + self.getOpts())])
+            return set(["rd.dasd=%s" % self.busid])
 
 class NFSDevice(StorageDevice, NetworkStorageDevice):
     """ An NFS device """
-- 
1.7.10.2

_______________________________________________
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