[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 |   49 +++++++++++++++++++++++++++++++----------
 1 file changed, 37 insertions(+), 12 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 0d99324..06ae092 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -3831,23 +3831,48 @@ class DASDDevice(DiskDevice):
 
     def dracutSetupArgs(self):
         conf = "/etc/dasd.conf"
-        opts = {}
-
+        line = None
         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)][:1]
             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
+
+        # Create a translation mapping from dasd.conf format to module format
+        translate = {'use_diag': 'diag',
+                     'readonly': 'ro',
+                     'erplog': 'erplog',
+                     'failfast': 'failfast'}
+
+        # 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
+        opts = []
+        parts = line.split()
+        for chunk in parts[1:]:
+            try:
+                feat, val = chunk.split('=')
+                if int(val):
+                    opts.append(translate[feat])
+            except:
+                # If we don't know what the feature is (feat not in translate
+                # or if we get a val that doesn't cleanly convert to an int
+                # we can't do anything with it.
+                log.warning("failed to parse dasd feature %s" % chunk)
+
+        if opts:
+            return set(["rd.dasd=%s(%s)" % (self.busid,
+                                            ":".join(opts))])
         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