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

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

 



Resolves: rhbz#689520
---
 exception.py            |    8 ++++++++
 installinterfacebase.py |   11 +++++++++++
 storage/devices.py      |    2 +-
 storage/errors.py       |    5 ++++-
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/exception.py b/exception.py
index 21c9c6b..c9a2d18 100644
--- a/exception.py
+++ b/exception.py
@@ -30,11 +30,19 @@ import shutil
 import signal
 from flags import flags
 import kickstart
+import storage.errors
 
 import logging
 log = logging.getLogger("anaconda")
 
 class AnacondaExceptionHandler(ExceptionHandler):
+    def handleException(self, (ty, value, tb), obj):
+        if issubclass(ty, storage.errors.StorageError) and value.hardware_fault:
+            self.intf.hardwareError(value)
+        else:
+            super(AnacondaExceptionHandler, self).handleException((ty, value, tb),
+                                                                  obj)
+
     def postWriteHook(self, (ty, value, tb), anaconda):
         # See if /mnt/sysimage is present and put exception there as well
         if os.access("/mnt/sysimage/root", os.X_OK):
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/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..cec075c 100644
--- a/storage/errors.py
+++ b/storage/errors.py
@@ -21,7 +21,10 @@
 #
 
 class StorageError(Exception):
-    pass
+    def __init__(self, *args, **kwargs):
+        hardware_fault = kwargs.pop("hardware_fault", False)
+        super(StorageError, self).__init__(*args, **kwargs)
+        self.hardware_fault = hardware_fault
 
 # Device
 class DeviceError(StorageError):
-- 
1.7.5.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