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

[PATCH 1/2] Only write changed DASD attributes to rd_DASD params (#606783)



Only include option values in the rd_DASD parameter if the user has
changed the value.  This should reduce the amount of data written to
zipl.conf by a reasonable amount, which should keep most use cases
from exceeding the boot parameter length limit.
---
 loader/linuxrc.s390 |    4 ++++
 storage/devices.py  |   21 ++++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 26eda61..5205182 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -2535,9 +2535,11 @@ function parse_dasd() {
                 # now apply $attrs and set DASDs $lo to $hi online
                 [ -z "$hi" ] && hi=$lo
                 local devno lodevno=$((0x${lo##*.})) hidevno=$((0x${hi##*.}))
+                local dasdconf="/etc/dasd.conf"
                 for ((devno=$lodevno; $devno <= $hidevno; ++devno)); do
                     local devbusid=$(printf "%s.%04x" ${lo%.*} $devno)
                     local sys="/sys/bus/ccw/devices/"$devbusid
+                    echo -n "$devbusid" >> $dasdconf
                     for attr in $attrs; do
                         if [ "$attr" = "use_diag" ]; then
                             # diag discipline cannot be auto-loaded
@@ -2550,6 +2552,7 @@ function parse_dasd() {
                         if ! sysecho $sys/$attr 1; then
                             echo $"Could not set attribute $attr for DASD $devbusid"
                         fi
+                        echo -n " $attr=1" >> $dasdconf
                     done
                     if [ ! -f $sys/online ]; then
                         echo $"DASD $devbusid not found"
@@ -2558,6 +2561,7 @@ function parse_dasd() {
                     if ! sysecho $sys/online 1; then
                         echo $"Could not set DASD $devbusid online"
                     fi
+                    echo >> $dasdconf
                 done
                 ;;
         esac
diff --git a/storage/devices.py b/storage/devices.py
index 42da7a4..8833ae2 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3566,9 +3566,24 @@ class DASDDevice(DiskDevice):
         return map(lambda (k, v): "%s=%s" % (k, v,), self.opts.items())
 
     def dracutSetupString(self):
-        args = ["rd_DASD=%s" % (self.busid,)] + self.getOpts()
-        return ",".join(args)
-
+        conf = "/etc/dasd.conf"
+        opts = {}
+
+        if os.path.isfile(conf):
+            f = open(conf)
+            lines = filter(lambda y: not y.startswith('#') and y != '',
+                           map(lambda x: x.strip(), f.readlines()))
+            f.close()
+
+            for line in lines:
+                parts = line.split()
+                if parts != []:
+                    opts[parts[0]] = parts
+
+        if self.busid in opts.keys():
+            return "rd_DASD=%s" % ",".join(opts[self.busid])
+        else:
+            return "rd_DASD=%s" % ",".join([self.busid] + self.getOpts())
 
 class NFSDevice(StorageDevice, NetworkStorageDevice):
     """ An NFS device """
-- 
1.7.1.1


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