Re: [PATCH 2/2] Do not add DASD default options to rd_DASD option (#606783)

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

 



On Fri, 25 Jun 2010, Steffen Maier wrote:

I'm pretty sure this won't work.

Linuxrc.s390 sets those DASD sysfs attributes (previously with RHEL5 it
was loader by means of the dasd_mod driver module parameter dasd=) and
to my knowledge there is no other code in anaconda that ever modifies
those values. Hence the code below compares the value that has already
been set with the exact same value which has not been modified meanwhile.

Only linuxrc.s390 (or whoever is the first to write to those sysfs
attributes) is able to read the driver default values before overwriting
them. That's why the correct solution for the current design would have
to remember either the default value or--even better--just the
overridden attributes for each DASD in linuxrc.s390 and pass it on to
anaconda probably by means of a file (as with /tmp/s390net).

Yes, this is better given how things work now in the installer.  Here is an
updated patch to collect the values during the linuxrc.s390 run and then pull
those in during the dracutSetupString() run.

The approach here is very simple.  Just build rd_DASD= values during the
linuxrc.s390 run and store them in /tmp/s390dracut.  Then pull them in during
the dracutSetupString() run if the busid matches, falling back on what we
currently do if there isn't a line in s390dracut for the device we are
currently looking at.

---
 loader/linuxrc.s390 |    7 +++++++
 storage/devices.py  |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 26eda61..e830295 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -2538,18 +2538,25 @@ function parse_dasd() {
                 for ((devno=$lodevno; $devno <= $hidevno; ++devno)); do
                     local devbusid=$(printf "%s.%04x" ${lo%.*} $devno)
                     local sys="/sys/bus/ccw/devices/"$devbusid
+                    local dracutopts="/tmp/s390dracut"
                     for attr in $attrs; do
+                        echo -n "$devbusid" >> $dracutopts
                         if [ "$attr" = "use_diag" ]; then
                             # diag discipline cannot be auto-loaded
                             modprobe dasd_diag_mod
+                            echo -n ",use_diag=1" >> $dracutopts
                         fi
                         if [ ! -f $sys/$attr ]; then
                             echo $"DASD $devbusid does not provide attribute $attr"
+                            echo >> $dracutopts
                             continue
                         fi
                         if ! sysecho $sys/$attr 1; then
                             echo $"Could not set attribute $attr for DASD $devbusid"
+                        else
+                            echo -n ",$attr=1" >> $dracutopts
                         fi
+                        echo >> $dracutopts
                     done
                     if [ ! -f $sys/online ]; then
                         echo $"DASD $devbusid not found"
diff --git a/storage/devices.py b/storage/devices.py
index 0f6e892..1e30f28 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3556,6 +3556,7 @@ class DASDDevice(DiskDevice):
         self.busid = kwargs.pop('busid')
         self.opts = kwargs.pop('opts')
         self.dasd = kwargs.pop('dasd')
+        self.dracutopts = "/tmp/s390dracut"
         DiskDevice.__init__(self, device, **kwargs)

         if self.dasd:
@@ -3565,6 +3566,15 @@ class DASDDevice(DiskDevice):
         return map(lambda (k, v): "%s=%s" % (k, v,), self.opts.items())

     def dracutSetupString(self):
+        if os.path.isfile(self.dracutopts):
+            f = open(self.dracutopts)
+            lines = map(lambda x: x.strip(), f.readlines())
+            f.close()
+
+            for line in lines:
+                if line.startswith(self.busid):
+                    return "rd_DASD=%s" % line
+
         args = ["rd_DASD=%s" % (self.busid,)] + self.getOpts()
         return ",".join(args)

--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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