[master&rhel6-branch] Show zFCP errors in dialog boxes rather than tracebacks (#598087)

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

 



Rather than raise an exception, show error messages in dialog boxes
or log if there is no UI.

(Based on patch from David Cantrell <dcantrell@xxxxxxxxxx>)
---
 iw/filter_gui.py    |    2 +-
 storage/__init__.py |    2 +-
 storage/zfcp.py     |   20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index a85cd1f..7d3c7f0 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -556,7 +556,7 @@ class FilterWindow(InstallWindow):
         # So that drives onlined by these show up in the filter UI
         storage.iscsi.iscsi().startup(anaconda.intf)
         storage.fcoe.fcoe().startup(anaconda.intf)
-        storage.zfcp.ZFCP().startup()
+        storage.zfcp.ZFCP().startup(anaconda.intf)
         storage.dasd.DASD().startup(anaconda.intf,
                                     anaconda.id.storage.exclusiveDisks,
                                     anaconda.id.storage.zeroMbr)
diff --git a/storage/__init__.py b/storage/__init__.py
index f541014..f2b597b 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -357,7 +357,7 @@ class Storage(object):
                                           _("Finding storage devices"))
         self.iscsi.startup(self.anaconda.intf)
         self.fcoe.startup(self.anaconda.intf)
-        self.zfcp.startup()
+        self.zfcp.startup(self.anaconda.intf)
         self.dasd.startup(self.anaconda.intf, self.exclusiveDisks, self.zeroMbr)
         if self.anaconda.id.getUpgrade():
             clearPartType = CLEARPART_TYPE_NONE
diff --git a/storage/zfcp.py b/storage/zfcp.py
index 53a02d8..0942067 100644
--- a/storage/zfcp.py
+++ b/storage/zfcp.py
@@ -331,6 +331,7 @@ class ZFCP:
     """
 
     def __init__(self):
+        self.intf = None
         self.fcpdevs = set()
         self.hasReadConfig = False
         self.down = True
@@ -356,15 +357,27 @@ class ZFCP:
             fields = line.split()
 
             if len(fields) == 3:
-                self.addFCP(fields[0], fields[1], fields[2])
+                devnum = fields[0]
+                wwpn   = fields[1]
+                fcplun = fields[2]
             elif len(fields) == 5:
                 # support old syntax of:
                 # devno scsiid wwpn scsilun fcplun
-                self.addFCP(fields[0], fields[2], fields[4])
+                devnum = fields[0]
+                wwpn   = fields[2]
+                fcplun = fields[4]
             else:
                 log.warn("Invalid line found in %s: %s" % (zfcpconf, line,))
                 continue
 
+            try:
+                self.addFCP(devnum, wwpn, fcplun)
+            except ValueError, e:
+                if self.intf:
+                    self.intf.messageWindow(_("Error"), str(e))
+                else:
+                    log.warning(str(e))
+
     def addFCP(self, devnum, wwpn, fcplun):
         d = ZFCPDevice(devnum, wwpn, fcplun)
         if d.onlineDevice():
@@ -382,7 +395,8 @@ class ZFCP:
             except ValueError, e:
                 log.warn(str(e))
 
-    def startup(self):
+    def startup(self, intf):
+        self.intf = intf
         if not self.down:
             return
         self.down = False
-- 
1.7.0.4


_______________________________________________
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