[rhel6] Allow missing swap devices to be skipped during upgrade

Vratislav Podzimek vpodzime at redhat.com
Thu Aug 7 07:00:04 UTC 2014


On Wed, 2014-08-06 at 09:45 -0400, David Shea wrote:
> A non-existent swap device from /etc/fstab is not treated as fatal
> during boot, so allow them to be treated as non-fatal during an anaconda
> upgrade, too.
> 
> Resolves: rhbz#1044716
> ---
>  storage/__init__.py | 39 +++++++++++++++++++++++++++------------
>  1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/storage/__init__.py b/storage/__init__.py
> index a9bbe81..8e227c5 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -1917,6 +1917,21 @@ class FSSet(object):
>              else:
>                  sys.exit(0)
>  
> +        def swapMissingDialog(msg, device):
> +            if not anaconda.intf:
> +                sys.exit(0)
> +
> +            buttons = [_("Skip"), _("Exit")]
> +            ret = anaconda.intf.messageWindow(_("Error"), msg, type="custom",
> +                                              custom_buttons=buttons,
> +                                              custom_icon="warning")
> +
> +            if ret == 0:
> +                self.devicetree._removeDevice(device)
> +                return False
> +            else:
> +                sys.exit(0)
> +
>          for device in self.swapDevices:
>              if isinstance(device, FileDevice):
>                  # set up FileDevices' parents now that they are accessible
> @@ -1976,24 +1991,24 @@ class FSSet(object):
>                      if swapErrorDialog(msg, device):
>                          continue
>                  except DeviceError as (msg, name):
> -                    if anaconda.intf:
> -                        if upgrading:
> -                            err = _("Error enabling swap device %(name)s: "
> -                                    "%(msg)s\n\n"
> -                                    "The /etc/fstab on your upgrade partition "
> -                                    "does not reference a valid swap "
> -                                    "device.\n\nPress OK to exit the "
> -                                    "installer") % {'name': name, 'msg': msg}
> -                        else:
> +                    if upgrading:
> +                        msg = _("Error enabling swap device %(name)s: "
> +                                "%(msg)s\n\n"
> +                                "The /etc/fstab on your upgrade partition "
> +                                "does not reference a valid swap "
> +                                "device.") % {'name': name, 'msg': msg}
> +
> +                        swapMissingDialog(msg, device)
> +                    else:
> +                        if anaconda.intf:
>                              err = _("Error enabling swap device %(name)s: "
>                                      "%(msg)s\n\n"
>                                      "This most likely means this swap "
>                                      "device has not been initialized.\n\n"
>                                      "Press OK to exit the installer.") % \
>                                    {'name': name, 'msg': msg}
> -                        anaconda.intf.messageWindow(_("Error"), err)
> -                    sys.exit(0)
> -
> +                            anaconda.intf.messageWindow(_("Error"), err)
> +                        sys.exit(0)
>                  break
>  
>      def mountFilesystems(self, anaconda, raiseErrors=None, readOnly=None,
I'm not sure that 0 is the best choice for sys.exit() in cases it is
used in this patch, but it keeps the same behaviour so ACK.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list