Re: [PATCH 4/4] Show zFCP errors in dialog boxes rather than tracebacks (#598087)

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

 



On 06/02/2010 09:59 PM, David Cantrell wrote:
> Rather than raise an exception, show error messages in dialog boxes.
> ---
>  storage/__init__.py |    2 +-
>  storage/zfcp.py     |  164 ++++++++++++++++++++++++++++++++------------------
>  2 files changed, 106 insertions(+), 60 deletions(-)
> 
> diff --git a/storage/__init__.py b/storage/__init__.py
> index dfe8a78..9db055a 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -359,7 +359,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

Also have a similar modification for the call of ZFCP.startup() in
iw/filter_gui.py:FilterWindow.getScreen?

> diff --git a/storage/zfcp.py b/storage/zfcp.py
> index 3c315e8..7d17b89 100644
> --- a/storage/zfcp.py
> +++ b/storage/zfcp.py
> @@ -42,17 +42,26 @@ scsidevsysfs = "/sys/bus/scsi/devices"
>  zfcpconf = "/etc/zfcp.conf"
> 
>  class ZFCPDevice:

Nack to all ZFCPDevice changes. This class is a utility class which
should not have to do anything with UI directly. I liked the way it
throws exceptions and the caller can react accordingly.

After all there are callers that don't have any intf to pass in. Then we
cannot display error dialogs here. Still the user should be able to
identify errors that happened and we've been doing that by logging.

Granted, I am still aware of the problems with logging translated
strings since we also use the same strings for error dialogs.
Whatever solution we find, I would rather not loose logging for cases
without intf. Otherwise not only users but we also won't be able to
debug anything.

> @@ -329,6 +373,7 @@ class ZFCP:
>      """
> 
>      def __init__(self):
> +        self.intf = None
>          self.fcpdevs = set()
>          self.hasReadConfig = False
>          self.down = True
> @@ -364,7 +409,7 @@ class ZFCP:
>                  continue
> 
>      def addFCP(self, devnum, wwpn, fcplun):
> -        d = ZFCPDevice(devnum, wwpn, fcplun)
> +        d = ZFCPDevice(self.intf, devnum, wwpn, fcplun)

I think that's not necessary.

>          if d.onlineDevice():
>              self.fcpdevs.add(d)
> 
> @@ -380,7 +425,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

My idea was a much more concise fix implementation, namely catching
ValueErrors in ZFCP.readConfig (which calls addFCP throwing them).
readConfig would only need intf once in the catch clause and if intf was
Null, it should log.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
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