FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 06-17-2011, 02:56 PM
Ales Kozumplik
 
Default 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:

%s.

"
+ "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.protecte d)
- 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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-29-2011, 08:51 AM
Ales Kozumplik
 
Default Do not traceback on mpath errors caused by faulty hardware.

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:

%s.

"
+ "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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-29-2011, 03:57 PM
Chris Lumens
 
Default Do not traceback on mpath errors caused by faulty hardware.

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

I like this approach much better. In general I do like the idea of
trying to track down hardware failures and report them instead of
generating tracebacks that people will file as bugs. I'm just
pessimistic as to how successful we are going to be.

> 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:

%s.

"
> + "The installer will now terminate.") % str(exception)

Little grammar nitpick here. The first sentence should be broken up
into two, as follows:

"The installation was stopped due to what seems to be a problem with
your hardware. The exact error message is:"

> 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):

Another little nitpick. Is there a problem with keeping hardware_fault
in the kwargs when you call the superclass's __init__? Alternately, is
there a problem with setting self.hardware_fault before you call the
same?

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-29-2011, 03:57 PM
Chris Lumens
 
Default Do not traceback on mpath errors caused by faulty hardware.

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

I like this approach much better. In general I do like the idea of
trying to track down hardware failures and report them instead of
generating tracebacks that people will file as bugs. I'm just
pessimistic as to how successful we are going to be.

> 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:

%s.

"
> + "The installer will now terminate.") % str(exception)

Little grammar nitpick here. The first sentence should be broken up
into two, as follows:

"The installation was stopped due to what seems to be a problem with
your hardware. The exact error message is:"

> 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):

Another little nitpick. Is there a problem with keeping hardware_fault
in the kwargs when you call the superclass's __init__? Alternately, is
there a problem with setting self.hardware_fault before you call the
same?

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-30-2011, 07:50 AM
Ales Kozumplik
 
Default Do not traceback on mpath errors caused by faulty hardware.

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..d4f20fa 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:

%s.

"
+ "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..f8d2d09 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)
+ self.hardware_fault = hardware_fault
+ super(StorageError, self).__init__(*args, **kwargs)

# Device
class DeviceError(StorageError):
--
1.7.5.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-30-2011, 07:54 AM
Ales Kozumplik
 
Default Do not traceback on mpath errors caused by faulty hardware.

On 06/29/2011 05:57 PM, Chris Lumens wrote:

+
+ 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:

%s.

"
+ "The installer will now terminate.") % str(exception)


Little grammar nitpick here. The first sentence should be broken up
into two, as follows:

"The installation was stopped due to what seems to be a problem with
your hardware. The exact error message is:"


Fixed.


+ 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):


Another little nitpick. Is there a problem with keeping hardware_fault
in the kwargs when you call the superclass's __init__? Alternately, is


Exception won't take it:

>>> Exception(hardware_fault=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: exceptions.Exception does not take keyword arguments



there a problem with setting self.hardware_fault before you call the
same?


I fixed this. The C++ guy in me just tries to call the constructor of
the superclass as soon as possible, but it doesn't matter and looks
better the other way here.


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 06-30-2011, 07:55 AM
Ales Kozumplik
 
Default Do not traceback on mpath errors caused by faulty hardware.

On 06/30/2011 09:50 AM, Ales Kozumplik wrote:

+ hardware_fault = kwargs.pop("hardware_fault", False)
+ self.hardware_fault = hardware_fault


This should be reduced to one statement of course, fixed on my branch.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-12-2011, 08:37 PM
Chris Lumens
 
Default Do not traceback on mpath errors caused by faulty hardware.

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

Looks okay to me.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:53 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org