[PATCH 2/2] Write /etc/dasd.conf to target system on s390 (#533833).

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

 



Similar to what we have to do for zFCP, write /etc/dasd.conf to the
target system for all DASD devices that have been used during
installation.  The device address as well as flags that can be set via
sysfs.
---
 storage/__init__.py   |    7 +++++--
 storage/dasd.py       |   19 +++++++++++++++++++
 storage/devices.py    |    4 ++++
 storage/devicetree.py |    4 +++-
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index a3a403c..ee8abef 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -270,7 +270,8 @@ class Storage(object):
                                      zeroMbr=self.zeroMbr,
                                      passphrase=self.encryptionPassphrase,
                                      luksDict=self.__luksDevs,
-                                     iscsi=self.iscsi)
+                                     iscsi=self.iscsi,
+                                     dasd=self.dasd)
         self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
 
     def doIt(self):
@@ -338,7 +339,8 @@ class Storage(object):
                                      zeroMbr=self.zeroMbr,
                                      passphrase=self.encryptionPassphrase,
                                      luksDict=self.__luksDevs,
-                                     iscsi=self.iscsi)
+                                     iscsi=self.iscsi,
+                                     dasd=self.dasd)
         self.devicetree.populate()
         self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
         self.anaconda.id.rootParts = None
@@ -975,6 +977,7 @@ class Storage(object):
         self.iscsi.write(instPath, self.anaconda)
         self.fcoe.write(instPath, self.anaconda)
         self.zfcp.write(instPath)
+        self.dasd.write(instPath)
 
     def writeKS(self, f):
         def useExisting(lst):
diff --git a/storage/dasd.py b/storage/dasd.py
index eebae53..48e47c2 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -43,6 +43,7 @@ class DASD:
 
     def __init__(self):
         self._dasdlist = []
+        self._devices = []                  # list of DASDDevice objects
         self.totalCylinders = 0
         self._completedCylinders = 0.0
         self._maxFormatJobs = 0
@@ -166,6 +167,24 @@ class DASD:
                 iutil.execWithRedirect(self.dasdfmt, argv + [dasd],
                                        stdout="/dev/tty5", stderr="/dev/tty5")
 
+    def addDASD(self, dasd):
+        """ Adds a DASDDevice to the internal list of DASDs. """
+        if dasd:
+            self._devices.append(dasd)
+
+    def write(self, instPath):
+        """ Write /etc/dasd.conf to target system for all DASD devices
+            configured during installation.
+        """
+        if self._devices == []:
+            return
+
+        f = open(os.path.realpath(instPath + "/etc/dasd.conf"), "w")
+        for dasd in self._devices:
+            fields = [dasd.busid] + dasd.getOpts()
+            f.write("%s\n" % (" ".join(fields),))
+        f.close()
+
     def _updateProgressWindow(self, data, callback_data=None):
         """ Reads progress output from dasdfmt and collects the number of
             cylinders completed so the progress window can update.
diff --git a/storage/devices.py b/storage/devices.py
index 1d51962..20a642b 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3153,8 +3153,12 @@ class DASDDevice(DiskDevice):
     def __init__(self, device, **kwargs):
         self.busid = kwargs.pop('busid')
         self.opts = kwargs.pop('opts')
+        self.dasd = kwargs.pop('dasd')
         DiskDevice.__init__(self, device, **kwargs)
 
+        if self.dasd:
+            self.dasd.addDASD(self)
+
     def getOpts(self):
         return map(lambda (k, v): "%s=%s" % (k, v,), self.opts.items())
 
diff --git a/storage/devicetree.py b/storage/devicetree.py
index dda90e4..b651bea 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -206,7 +206,7 @@ class DeviceTree(object):
 
     def __init__(self, intf=None, ignored=[], exclusive=[], type=CLEARPART_TYPE_NONE,
                  clear=[], zeroMbr=None, reinitializeDisks=None, protected=[],
-                 passphrase=None, luksDict=None, iscsi=None):
+                 passphrase=None, luksDict=None, iscsi=None, dasd=None):
         # internal data members
         self._devices = []
         self._actions = []
@@ -221,6 +221,7 @@ class DeviceTree(object):
         self.zeroMbr = zeroMbr
         self.reinitializeDisks = reinitializeDisks
         self.iscsi = iscsi
+        self.dasd = dasd
 
         # protected device specs as provided by the user
         self.protectedDevSpecs = protected
@@ -1163,6 +1164,7 @@ class DeviceTree(object):
             kwargs["exists"]  = True
         elif udev_device_is_dasd(info):
             diskType = DASDDevice
+            kwargs["dasd"] = self.dasd
             kwargs["busid"] = udev_device_get_dasd_bus_id(info)
             kwargs["opts"] = {}
 
-- 
1.6.5.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