[master/f21/rhel7-branch] s390x: show dialog if kernel cmdline in zipl.conf is too long. (#885011)

Anne Mulhern amulhern at redhat.com
Mon Oct 6 14:18:54 UTC 2014





----- Original Message -----
> From: "Anne Mulhern" <amulhern at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Monday, October 6, 2014 9:48:06 AM
> Subject: Re: [master/f21/rhel7-branch] s390x: show dialog if kernel cmdline	in	zipl.conf is too long. (#885011)
> 
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Friday, October 3, 2014 1:46:30 PM
> > Subject: [master/f21/rhel7-branch] s390x: show dialog if kernel cmdline in
> > 	zipl.conf is too long. (#885011)
> > 
> > On s390x, the kernel cmdline has a hard limit of 896 bytes in length.
> > There is nothing we can do to circumvent this, so instead of just
> > crashing, handle the error gracefully by showing an error window and
> > telling the user they need to reboot.
> > 
> > Resolves: rhbz#885011
> > ---
> >  pyanaconda/bootloader.py |  8 ++++++--
> >  pyanaconda/errors.py     | 15 ++++++++++++++-
> >  2 files changed, 20 insertions(+), 3 deletions(-)
> > 
> > diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> > index 4832c49..3264e98 100644
> > --- a/pyanaconda/bootloader.py
> > +++ b/pyanaconda/bootloader.py
> > @@ -36,6 +36,7 @@ from pyanaconda.flags import flags
> >  from blivet.errors import StorageError
> >  from blivet.fcoe import fcoe
> >  import pyanaconda.network
> > +from pyanaconda.errors import errorHandler, ERROR_RAISE
> >  from pyanaconda.packaging.rpmostreepayload import RPMOSTreePayload
> >  from pyanaconda.nm import nm_device_hwaddress
> >  from blivet import platform
> > @@ -2158,6 +2159,11 @@ class ZIPL(BootLoader):
> >                  # We want to extract the device name and pass that.
> >                  name = re.sub(r".+?: ", "", line)
> >                  self.stage1_name = re.sub(r"(\s\(.+\))?\.$", "", name)
> > +            # a limitation of s390x is that the kernel parameter list must
> > not
> > +            # exceed 896 bytes; there is nothing we can do about this, so
> > just
> > +            # catch the error and show it to the user instead of crashing
> > +            elif line.startswith("Error: The length of the parameters "):
> > +                errorHandler.cb(ZIPLError(line))
> >  
> >          if not self.stage1_name:
> >              raise BootLoaderError("could not find IPL device")
> > @@ -2370,8 +2376,6 @@ def writeSysconfigKernel(storage, version):
> >  def writeBootLoaderFinal(storage, payload, instClass, ksdata):
> >      """ Do the final write of the bootloader. """
> >  
> > -    from pyanaconda.errors import errorHandler, ERROR_RAISE
> > -
> >      # set up dracut/fips boot args
> >      # XXX FIXME: do this from elsewhere?
> >      storage.bootloader.set_boot_args(storage=storage,
> > diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py
> > index 1541c46..e2da7f1 100644
> > --- a/pyanaconda/errors.py
> > +++ b/pyanaconda/errors.py
> > @@ -49,6 +49,9 @@ class PasswordCryptError(Exception):
> >          Exception.__init__(self)
> >          self.algo = algo
> >  
> > +class ZIPLError(Exception):
> > +    pass
> > +
> >  # These constants are returned by the callback in the ErrorHandler class.
> >  # Each represents a different kind of action the caller can take:
> >  #
> > @@ -257,6 +260,15 @@ class ErrorHandler(object):
> >          self.ui.showError(message)
> >          return ERROR_RAISE
> >  
> > +    def _ziplErrorHandler(self, *args, **kwargs):
> > +        details = kwargs["exception"]
> > +        message = _("Installation was stopped due to an error installing
> > the
> > "
> > +                    "boot loader. The exact error message is:\n\n%s\n\n"
> > +                    "The installer will now terminate.") % details
> 
> If showError does not handle translation, then message should get an N_, not
> just
> an _, I think.
> 
> > +
> > +        self.ui.showError(message)
> > +        return ERROR_RAISE
> > +
> >      def cb(self, exn, *args, **kwargs):
> >          """This method is the callback that all error handling should pass
> >             through.  The return value is one of the ERROR_* constants
> >             defined
> > @@ -290,7 +302,8 @@ class ErrorHandler(object):
> >                  "ScriptError": self._scriptErrorHandler,
> >                  "PayloadInstallError": self._payloadInstallHandler,
> >                  "DependencyError": self._dependencyErrorHandler,
> > -                "PasswordCryptError": self._passwordCryptErrorHandler}
> > +                "PasswordCryptError": self._passwordCryptErrorHandler,
> > +                "ZIPLError": self._ziplErrorHandler}
> >  
> >          if exn.__class__.__name__ in _map:
> >              kwargs["exception"] = exn
> > --
> > 1.9.3
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> - mulhern
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

But showError() must handle translation, because all the code in errors.py seems
to expect it to.

So, looks good.

- mulhern


More information about the anaconda-patches mailing list