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

[PATCH 3/5] Create a MainframeDiskDevice class for common s390 attributes.



Create a MainframeDiskDevice class to hold common s390 attributes
across the disk types specific to that platform.  For now, it
does not do much except return self.desc for chreipl failures.
Oh, and build self.desc for DASDDevice and ZFCPDiskDevice which
is a slightly more human-readable string explaining where this
particular device lives on the system in z-speak.

Related: rhbz#632325
---
 storage/devices.py |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 7d7dd51..72bcf2e 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3581,7 +3581,15 @@ class OpticalDevice(StorageDevice):
         os.close(fd)
 
 
-class ZFCPDiskDevice(DiskDevice):
+class MainframeDiskDevice(DiskDevice):
+    """ Abstract mainframe disk. """
+    _type = "mainframe"
+
+    def reIPLDescription(self):
+        return self.desc
+
+
+class ZFCPDiskDevice(MainframeDiskDevice):
     """ A mainframe ZFCP disk. """
     _type = "zfcp"
 
@@ -3589,10 +3597,15 @@ class ZFCPDiskDevice(DiskDevice):
         self.hba_id = kwargs.pop("hba_id")
         self.wwpn = kwargs.pop("wwpn")
         self.fcp_lun = kwargs.pop("fcp_lun")
-        DiskDevice.__init__(self, device, **kwargs)
+        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)
 
     def __str__(self):
-        s = DiskDevice.__str__(self)
+        s = MainframeDiskDevice.__str__(self)
         s += ("  hba_id = %(hba_id)s  wwpn = %(wwpn)s  fcp_lun = %(fcp_lun)s" %
               {"hba_id": self.hba_id,
                "wwpn": self.wwpn,
@@ -3603,7 +3616,7 @@ class ZFCPDiskDevice(DiskDevice):
         return "rd_ZFCP=%s,%s,%s" % (self.hba_id, self.wwpn, self.fcp_lun,)
 
 
-class DASDDevice(DiskDevice):
+class DASDDevice(MainframeDiskDevice):
     """ A mainframe DASD. """
     _type = "dasd"
 
@@ -3611,7 +3624,8 @@ class DASDDevice(DiskDevice):
         self.busid = kwargs.pop('busid')
         self.opts = kwargs.pop('opts')
         self.dasd = kwargs.pop('dasd')
-        DiskDevice.__init__(self, device, **kwargs)
+        self.desc = _("DASD device %s" % self.busid)
+        MainframeDiskDevice.__init__(self, device, **kwargs)
 
         if self.dasd:
             self.dasd.addDASD(self)
-- 
1.7.3.2


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