[PATCH] Mount efivarfs under /mnt/sysimage on appropriate platforms

Anne Mulhern amulhern at redhat.com
Fri Jan 2 13:32:51 UTC 2015





----- Original Message -----
> From: "Peter Jones" <pjones at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Thursday, December 18, 2014 2:49:15 PM
> Subject: [PATCH] Mount efivarfs under /mnt/sysimage on appropriate platforms
> 
> Bug 1129435 was fixed in the efibootmgr code, but that code only works
> if we've got the newer kernel interface available, which requires
> mounting it.  If we don't mount it, we hit the old code path, which
> doesn't allow us to create device paths > 1024 bytes.
> 
> Signed-off-by: Peter Jones <pjones at redhat.com>
> ---
>  blivet/__init__.py | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/blivet/__init__.py b/blivet/__init__.py
> index 210d3c6..2c8d26b 100644
> --- a/blivet/__init__.py
> +++ b/blivet/__init__.py
> @@ -85,6 +85,7 @@ from . import util
>  from . import arch
>  from .flags import flags
>  from .platform import platform as _platform
> +from .platform import EFI
>  from .size import Size
>  from .i18n import _
>  
> @@ -2260,6 +2261,7 @@ class FSSet(object):
>          self._devshm = None
>          self._usb = None
>          self._selinux = None
> +        self._efivars = None
>          self._run = None
>          self._fstab_swaps = set()
>          self.preserveLines = []     # lines we just ignore and preserve
> @@ -2310,6 +2312,12 @@ class FSSet(object):
>          return self._selinux
>  
>      @property
> +    def efivars(self):

Would be nice if this method had a docstring.

> +        if not self._efivars:
> +            self._efivars = NoDevice(fmt=getFormat("efivarfs",
> device="efivarfs", mountpoint="/sys/firmware/efi/efivars"))

I think that this expression will yield a NoDevice object with
format of type DeviceFormat. It won't if somebody defines some
kind of efivarfs format, but there is none in the codebase now.

The property mountable() is False by default for DeviceFormats.

> +        return self._efivars
> +
> +    @property
>      def run(self):
>          if not self._run:
>              self._run = DirectoryDevice("/run",
> @@ -2386,7 +2394,8 @@ class FSSet(object):
>                                        device=device.path,
>                                        exists=True)
>          elif mountpoint in ("/proc", "/sys", "/dev/shm", "/dev/pts",
> -                            "/sys/fs/selinux", "/proc/bus/usb"):
> +                            "/sys/fs/selinux", "/proc/bus/usb",
> +                            "/sys/firmware/efi/efivars"):
>              # drop these now -- we'll recreate later
>              return None
>          else:
> @@ -2554,6 +2563,8 @@ class FSSet(object):
>          devices = list(self.mountpoints.values()) + self.swapDevices
>          devices.extend([self.dev, self.devshm, self.devpts, self.sysfs,
>                          self.proc, self.selinux, self.usb, self.run])
> +        if isinstance(_platform, EFI):
> +            devices.append(self.efivars)

I think that if mountable is False for this device's format, it will be skipped
entirely in the ensuing loop making adding it to the list of devices pointless.

>          devices.sort(key=lambda d: getattr(d.format, "mountpoint", None))
>  
>          for device in devices:
> @@ -2611,6 +2622,8 @@ class FSSet(object):
>          devices = list(self.mountpoints.values()) + self.swapDevices
>          devices.extend([self.dev, self.devshm, self.devpts, self.sysfs,
>                          self.proc, self.usb, self.selinux, self.run])
> +        if isinstance(_platform, EFI):
> +            devices.append(self.efivars)

Same as above.

>          devices.sort(key=lambda d: getattr(d.format, "mountpoint", None))
>          devices.reverse()
>          for device in devices:
> --
> 2.1.0
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

- mulhenr


More information about the anaconda-patches mailing list