[PATCH 2/2] Add handling for preexisting unusable storage configurations.

Vratislav Podzimek vpodzime at redhat.com
Mon Jan 12 14:05:03 UTC 2015


On Fri, 2015-01-09 at 15:34 -0600, David Lehman wrote:
> In the event that blivet finds a setup it cannot handle with any
> reasonable expectation of success it will raise
> UnusableConfigurationError. The user then has the option to resolve
> the issue and retry the storage scan or exit the installer.
> 
> Related: rhbz#1123450
> ---
>  pyanaconda/errors.py        | 16 ++++++++++++++++
>  pyanaconda/exception.py     |  4 ++++
>  pyanaconda/storage_utils.py | 13 +++++++++++--
>  3 files changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
> index a1671c6..436ea46 100644
> --- a/pyanaconda/errors.py
> +++ b/pyanaconda/errors.py
> @@ -123,6 +123,21 @@ class ErrorHandler(object):
>          self.ui.showError(message)
>          return ERROR_RAISE
>  
> +    def _unusableStorageHandler(self, *args, **kwargs):
> +        message = (_("An error has occurred while scanning your existing "
> +                     "storage configuration:\n\n%(errortxt)s\n\nYou must "
> +                     "resolve this matter before the installation can proceed. "
> +                     "There is a shell available for use which you can access "
> +                     "by pressing Ctrl-Alt-f1 and then Ctrl-b 2. Once you have "
> +                     "resolved the issue you can either retry the storage scan "
> +                     "or you can exit the installer.\n\n"
> +                     "Would you like to retry?")
> +                   % {"errortxt": kwargs["exception"]})
> +        if self.ui.showYesNoQuestion(message):
> +            return ERROR_RETRY
> +        else:
> +            return ERROR_RAISE
> +
>      def _noDisksHandler(self, exn):
>          message = _("An error has occurred - no valid devices were found on "
>                      "which to create new file systems.  Please check your "
> @@ -287,6 +302,7 @@ class ErrorHandler(object):
>  
>          _map = {"PartitioningError": self._partitionErrorHandler,
>                  "FSResizeError": self._fsResizeHandler,
> +                "UnusableConfigurationError": self._unusableStorageHandler,
>                  "NoDisksError": self._noDisksHandler,
>                  "FSTabTypeMismatchError": self._fstabTypeMismatchHandler,
>                  "InvalidImageSizeError": self._invalidImageSizeHandler,
> diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
> index b8b8f4f..39da8ef 100644
> --- a/pyanaconda/exception.py
> +++ b/pyanaconda/exception.py
> @@ -68,6 +68,10 @@ class AnacondaExceptionHandler(ExceptionHandler):
>          :type dump_info: an instance of the meh.DumpInfo class
>  
>          """
> +        cls = dump_info.exc_info.type
> +        if issubclass(cls, blivet.errors.UnusableConfigurationError):
> +            log.info("exiting due to unusable storage configuration")
> +            sys.exit(0)
>  
>          super(AnacondaExceptionHandler, self).handleException(dump_info)
>          return False
At first I thought this should be moved into the handleException method
next to the HWError check instead of run_handleException, but some
testing has proven the opposite -- HWError checking should be moved to
run_handleException and all this stuff should be fixed to work. See the
three patches I just sent for more info.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list