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

[rhel6-branch] Do not traceback on mpath errors caused by faulty hardware.



Resolves: rhbz#689520
---
 installinterfacebase.py |   11 +++++++++++
 storage/__init__.py     |   13 +++++++++++--
 storage/devices.py      |    2 +-
 storage/errors.py       |    4 +++-
 4 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/installinterfacebase.py b/installinterfacebase.py
index 71cb9cb..6d4dd11 100644
--- a/installinterfacebase.py
+++ b/installinterfacebase.py
@@ -97,3 +97,14 @@ class InstallInterfaceBase(object):
                                              custom_icon=icon,
                                              custom_buttons=buttons,
                                              expanded=True)
+
+    def hardwareError(self, exception):
+        text=_("The installation was stopped due to what seems to be a problem "
+               "with your hardware, the exact error message is:\n\n%s.\n\n "
+               "The installer will now terminate.") % str(exception)
+        self.messageWindow(title=_("Hardware Error Encountered"),
+                           text=text,
+                           type="custom",
+                           custom_icon="error",
+                           custom_buttons=[_("_Exit installer")])
+        sys.exit(0)
diff --git a/storage/__init__.py b/storage/__init__.py
index 007f029..3c847f9 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -87,7 +87,7 @@ def storageInitialize(anaconda):
     # Set up the protected partitions list now.
     if anaconda.protected:
         storage.protectedDevSpecs.extend(anaconda.protected)
-        storage.reset()
+        storage.reset_checked(anaconda.intf)
 
         if not flags.livecdInstall and not storage.protectedDevices:
             if anaconda.id.getUpgrade():
@@ -100,7 +100,7 @@ def storageInitialize(anaconda):
                     type="custom", custom_buttons = [_("_Exit installer")])
                 sys.exit(1)
     else:
-        storage.reset()
+        storage.reset_checked(anaconda.intf)
 
     if not storage.disks:
         rc = anaconda.intf.messageWindow(_("No disks found"),
@@ -435,6 +435,15 @@ class Storage(object):
         self.dumpState("initial")
         w.pop()
 
+    def reset_checked(self, intf):
+        try:
+            self.reset()
+        except MPathError as e:
+            if e.hardware_fault:
+                intf.hardwareError(e)
+            else:
+                raise
+
     @property
     def devices(self):
         """ A list of all the devices in the device tree. """
diff --git a/storage/devices.py b/storage/devices.py
index a89de06..88741c1 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3382,7 +3382,7 @@ class MultipathDevice(DMDevice):
                             stderr = "/dev/tty5")
         if rc:
             raise MPathError("multipath activation failed for '%s'" %
-                            self.name)
+                            self.name, hardware_fault=True)
         udev_settle()
         self.setupPartitions()
         udev_settle()
diff --git a/storage/errors.py b/storage/errors.py
index 1d1fea0..81e8a68 100644
--- a/storage/errors.py
+++ b/storage/errors.py
@@ -126,7 +126,9 @@ class CryptoError(StorageError):
     pass
 
 class MPathError(StorageError):
-    pass
+    def __init__(self, msg, hardware_fault=False):
+        super(MPathError, self).__init__(msg)
+        self.hardware_fault = hardware_fault
 
 # DeviceTree
 class DeviceTreeError(StorageError):
-- 
1.7.5.4


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