[anaconda:rhel7/master] Cover both possible ways that GUI WWID may have been set (#1074184)

mulhern amulhern at redhat.com
Mon Mar 10 16:28:15 UTC 2014


Resolves: rhbz#1074184

All the pages on the filter screen interact with the same backing store,
and each page can add different items to that backing store.
Although Multipath page uses wwid attribute of multipath device Other page
synthesizes a wwid using the internal _long_identifier() method.
When filtering by wwid in Search page, need to check for both possible
values of WWID. Do not need to check for both when filtering on Multipath
page, as all devices for which ismember is True are multipath.
Moved _long_identifier() method up into parent class, so that SearchPage
could access it directly.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 pyanaconda/ui/gui/spokes/filter.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index af40ac2..ba0b144 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -136,6 +136,18 @@ class FilterPage(object):
         if items:
             combo.set_active(0)
 
+    def _long_identifier(self, disk):
+        # For iSCSI devices, we want the long ip-address:port-iscsi-tgtname-lun-XX
+        # identifier, but blivet doesn't expose that in any useful way and I don't
+        # want to go asking udev.  Instead, we dig around in the deviceLinks and
+        # default to the name if we can't figure anything else out.
+        for link in disk.deviceLinks:
+            if "by-path" in link:
+                lastSlash = link.rindex("/")+1
+                return link[lastSlash:]
+
+        return disk.name
+
 class SearchPage(FilterPage):
     def __init__(self, storage, builder):
         FilterPage.__init__(self, storage, builder)
@@ -203,7 +215,7 @@ class SearchPage(FilterPage):
         elif filterBy == 1:
             return self._port_equal(device) and self._target_equal(device) and self._lun_equal(device)
         elif filterBy == 2:
-            return hasattr(device, "wwid") and self._wwidEntry.get_text() in device.wwid
+            return self._wwidEntry.get_text() in (device.wwid if hasattr(device, "wwid") else self._long_identifier(device))
 
     def visible_func(self, model, itr, *args):
         obj = DiskStoreRow._make(model[itr])
@@ -290,18 +302,6 @@ class OtherPage(FilterPage):
     def ismember(self, device):
         return isinstance(device, iScsiDiskDevice) or isinstance(device, FcoeDiskDevice)
 
-    def _long_identifier(self, disk):
-        # For iSCSI devices, we want the long ip-address:port-iscsi-tgtname-lun-XX
-        # identifier, but blivet doesn't expose that in any useful way and I don't
-        # want to go asking udev.  Instead, we dig around in the deviceLinks and
-        # default to the name if we can't figure anything else out.
-        for link in disk.deviceLinks:
-            if "by-path" in link:
-                lastSlash = link.rindex("/")+1
-                return link[lastSlash:]
-
-        return disk.name
-
     def setup(self, store, selectedNames, disks):
         vendors = []
         interconnects = []
-- 
1.8.3.1



More information about the anaconda-patches mailing list