[rhel6] Fall back to first ESP if none have mountpoints (#1145812)

Brian C. Lane bcl at redhat.com
Tue Nov 4 17:09:14 UTC 2014


On Tue, Nov 04, 2014 at 07:29:37AM -0500, Anne Mulhern wrote:
> 
> 
> 
> 
> ----- Original Message -----
> > From: "Brian C. Lane" <bcl at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Monday, November 3, 2014 6:25:45 PM
> > Subject: [rhel6] Fall back to first ESP if none have mountpoints (#1145812)
> > 
> > The problem with that last patch is it still doesn't fall back to the 1st ESP
> > if there are none with a mountpoint.  This makes it keep creating new ESPs
> > when
> > using 'replace linux'.
> > 
> > I'd modify it like this:
> > 
> > ---
> >  platform.py | 18 +++++++++++++-----
> >  1 file changed, 13 insertions(+), 5 deletions(-)
> > 
> > diff --git a/platform.py b/platform.py
> > index a169e28..a7d32b2 100644
> > --- a/platform.py
> > +++ b/platform.py
> > @@ -248,6 +248,9 @@ class EFI(Platform):
> >          Return the boot device. The bootloader.drivelist is used to
> >          set the precedence in cases where multiple partitions are
> >          available from multiple devices.
> > +
> > +        Return the first ESP with a mountpoint, if there is one.
> > +        Otherwise return the first ESP.
> >          """
> >          drive = self.anaconda.id.bootloader.drivelist[0]
> >  
> > @@ -257,12 +260,17 @@ class EFI(Platform):
> >                 part.format.type == "efi" and \
> >                 self.validBootPartSize(part.size)
> >  
> > -        if self.isEfi:
> > -            isBootDevice = lambda part: _isBoot(part) and
> > part.format.mountpoint
> > -        else:
> > -            isBootDevice = _isBoot
> > +        bootDevice = None
> > +        for part in self.anaconda.id.storage.partitions:
> > +            if not _isBoot(part):
> > +                continue
> > +            if part.format.mountpoint:
> > +                bootDevice = part
> > +                break
> > +            elif bootDevice is None:
> > +                bootDevice = part
> >  
> > -        return next((p for p in self.anaconda.id.storage.partitions if
> > isBootDevice(p)), None)
> > +        return bootDevice
> >  
> >      def bootloaderChoices(self, bl):
> >          bootDev = self.bootDevice()
> > --
> > 1.9.3
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> When isEfi is True, a device w/out a mountpoint will always be rejected by EFI.checkBootRequest().
> As far as I can see, that means serving up a device w/out a mountpoint in bootDevice() when
> isEFI is True is pointless.

EFI.checkBootRequest isn't checked at the same time as EFI.bootDevice,
that is used for SanityCheck. So it will reject a custom partition setup
when they didn't select an ESP to mount -- which is the correct
behavior.

EFI.bootDevice is used for custom and for autopart to select an ESP, if
there is one. If a mountpoint was set in custom then you want to use
that one. If there was no mountpoint set (eg. reuse linux) then you want
to use the first one and set the mountpoint to '/boot/efi/'. This is
done in storage/partitioning.py

> 
> I'm assuming that you tested my most recent patch and found a similar problem to the one you described
> for the previous patch.

Correct. Your patch adds a new ESP when using autopart because EFI.bootDevice didn't
find one because it is requiring a mountpoint. This is the same problem
that commit 54e6717da3 fixed.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list