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

[PATCH] Remove MainframeDiskDevice class, use description property.



Just use the description property in the device classes to provide
the description of the device in case setting the reIPL device
fails.

Related: rhbz#632325
---
 pyanaconda/iutil.py           |    2 +-
 pyanaconda/storage/devices.py |   33 +++++++++++++++------------------
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index cf79dfc..e01a7c7 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -834,7 +834,7 @@ def reIPL(anaconda, loader_pid):
 
         for disk in anaconda.id.storage.disks:
             if disk.name == ipldev:
-                devstring = disk.reIPLDescription()
+                devstring = disk.description
                 break
 
         if devstring is None:
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index a599937..415f04c 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -3801,15 +3801,7 @@ class OpticalDevice(StorageDevice):
         os.close(fd)
 
 
-class MainframeDiskDevice(DiskDevice):
-    """ Abstract mainframe disk. """
-    _type = "mainframe"
-
-    def reIPLDescription(self):
-        return self.desc
-
-
-class ZFCPDiskDevice(MainframeDiskDevice):
+class ZFCPDiskDevice(DiskDevice):
     """ A mainframe ZFCP disk. """
     _type = "zfcp"
 
@@ -3817,12 +3809,7 @@ class ZFCPDiskDevice(MainframeDiskDevice):
         self.hba_id = kwargs.pop("hba_id")
         self.wwpn = kwargs.pop("wwpn")
         self.fcp_lun = kwargs.pop("fcp_lun")
-        self.desc = _("FCP device %(device)s with WWPN %(wwpn)s "
-                      "and LUN %(lun)s"
-                      % {'device': self.hba_id,
-                         'wwpn': self.wwpn,
-                         'lun': self.fcp_lun})
-        MainframeDiskDevice.__init__(self, device, **kwargs)
+        DiskDevice.__init__(self, device, **kwargs)
 
     def __str__(self):
         s = MainframeDiskDevice.__str__(self)
@@ -3832,11 +3819,18 @@ class ZFCPDiskDevice(MainframeDiskDevice):
                "fcp_lun": self.fcp_lun})
         return s
 
+    @property
+    def description(self):
+        return "FCP device %(device)s with WWPN %(wwpn)s and LUN %(lun)s" \
+               % {'device': self.hba_id,
+                  'wwpn': self.wwpn,
+                  'lun': self.fcp_lun})
+
     def dracutSetupString(self):
         return "rd_ZFCP=%s,%s,%s" % (self.hba_id, self.wwpn, self.fcp_lun,)
 
 
-class DASDDevice(MainframeDiskDevice):
+class DASDDevice(DiskDevice):
     """ A mainframe DASD. """
     _type = "dasd"
 
@@ -3844,12 +3838,15 @@ class DASDDevice(MainframeDiskDevice):
         self.busid = kwargs.pop('busid')
         self.opts = kwargs.pop('opts')
         self.dasd = kwargs.pop('dasd')
-        self.desc = _("DASD device %s" % self.busid)
-        MainframeDiskDevice.__init__(self, device, **kwargs)
+        DiskDevice.__init__(self, device, **kwargs)
 
         if self.dasd:
             self.dasd.addDASD(self)
 
+    @property
+    def description(self):
+        return "DASD device %s" % self.busid
+
     def getOpts(self):
         return map(lambda (k, v): "%s=%s" % (k, v,), self.opts.items())
 
-- 
1.7.3.3


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