[master/rhel7-branch] Display additional disk attributes in TUI storage spoke. (#1024760)

Samantha N. Bueno sbueno+anaconda at redhat.com
Thu Dec 19 21:05:26 UTC 2013


Note: I've only tested this with normal disks and s390x-specific
devices (DASD, zFCP). I might try and test this with some other
specialized device configurations to make sure information looks all
right and does not break anything, but I think it should be ok.

For DASDs, for instance, this is what is now shown:
Install Destination

[ ] 1) IBM S390 DASD drive: 2.34 GB (dasda), 0.0.0200

[ ] 2) IBM S390 DASD drive: 2.34 GB (dasdb), 0.0.0201

[ ] 3) IBM S390 DASD drive: 2.34 GB (dasdc), 0.0.0202

[ ] 4) IBM S390 DASD drive: 2.34 GB (dasdd), 0.0.0203

====

Some specialized disks are difficult to identify by name and model
alone in the TUI storage spoke, so show additional disk attributes
to help distinguish among devices.

Resolves: rhbz#1024760
---
 pyanaconda/ui/tui/spokes/storage.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 00fa9fe..de68813 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -29,6 +29,7 @@ from pyanaconda.ui.tui.simpleline import TextWidget, CheckboxWidget
 from pykickstart.constants import AUTOPART_TYPE_LVM, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_PLAIN
 from blivet.size import Size
 from blivet.errors import StorageError
+from blivet.devices import DASDDevice, FcoeDiskDevice, iScsiDiskDevice, MultipathDevice, ZFCPDiskDevice
 from pyanaconda.flags import flags
 from pyanaconda.kickstart import doKickstartStorage
 from pyanaconda.threads import threadMgr, AnacondaThread
@@ -182,9 +183,8 @@ class StorageSpoke(NormalTUISpoke):
 
         # loop through the disks and present them.
         for disk in self.disks:
-            size = size_str(disk.size)
-            c = CheckboxWidget(title="%i) %s: %s (%s)" % (self.disks.index(disk) + 1,
-                                                 disk.model, size, disk.name),
+            disk_info = self._format_disk_info(disk)
+            c = CheckboxWidget(title="%i) %s" % (self.disks.index(disk) + 1, disk_info),
                                completed=(disk.name in self.selected_disks))
             self._window += [c, ""]
 
@@ -192,6 +192,33 @@ class StorageSpoke(NormalTUISpoke):
 
         return True
 
+    def _format_disk_info(self, disk):
+        """ Some specialized disks are difficult to identify in the storage
+            spoke, so add and return extra identifying information about them.
+
+            Since this is going to be ugly to do within the confines of the
+            CheckboxWidget, pre-format the display string here.
+        """
+        # show this info for all disks
+        format_str = "%s: %s (%s)" % (disk.model, size_str(disk.size), disk.name)
+
+        disk_attrs = []
+        # now check for/add info about special disks
+        if (isinstance(disk, MultipathDevice) or isinstance(disk, iScsiDiskDevice) or isinstance(disk, FcoeDiskDevice)):
+            disk_attrs.append(disk.wwid)
+        elif isinstance(disk, DASDDevice):
+            disk_attrs.append(disk.busid)
+        elif isinstance (disk, ZFCPDiskDevice):
+            disk_attrs.append(disk.fcp_lun)
+            disk_attrs.append(disk.wwpn)
+            disk_attrs.append(disk.hba_id)
+
+        # now append all additional attributes to our string
+        for attr in disk_attrs:
+            format_str += ", %s" % attr
+
+        return format_str
+
     def input(self, args, key):
         """Grab the disk choice and update things"""
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list