Re: [PATCH] Fix EFI boot from multipath (forward port of #691794)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-03-05 at 10:47 +0100, Martin Sivak wrote:
> If we are booting from multipath, efibootmgr needs to be called on
> all constituent devices, much like RAID1 boot would be for it's
> mirrored /boot partitions.
> 
> Second version :)
> ---
>  pyanaconda/bootloader.py |   31 +++++++++++++++----------------
>  1 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index db0626f..463cfdc 100644
> --- a/pyanaconda/bootloader.py
> +++ b/pyanaconda/bootloader.py
> @@ -1520,22 +1520,21 @@ class EFIGRUB(GRUB):
>      def add_efi_boot_target(self):
>          boot_efi = self.storage.mountpoints["/boot/efi"]
>          if boot_efi.type == "partition":
> -            boot_disk = boot_efi.disk
> -            boot_part_num = boot_efi.partedPartition.number
> -        elif boot_efi.type == "mdarray":
> -            # FIXME: I'm just guessing here. This probably needs the full
> -            #        treatment, ie: multiple targets for each member.
> -            boot_disk = boot_efi.parents[0].disk
> -            boot_part_num = boot_efi.parents[0].partedPartition.number
> -        boot_part_num = str(boot_part_num)
> -
> -        rc = self.efibootmgr("-c", "-w", "-L", productName,
> -                             "-d", boot_disk.path, "-p", boot_part_num,
> -                             "-l", "\\EFI\\redhat\\grub.efi",
> -                             root=ROOT_PATH,
> -                             stdout="/dev/tty5", stderr="/dev/tty5")
> -        if rc:
> -            raise BootLoaderError("failed to set new efi boot target")
> +            boot_disks = [ boot_efi.disk ]
> +            boot_part_num = [ boot_efi.partedPartition.number ]
> +        elif boot_efi.type == "mdarray" or boot_efi.type == "dm-multipath":

You don't want to group these together. The layering is different.
Multipath and MD raid are not mutually exclusive. This means you'll need
to handle multipath separately so you can handle it regardless of
whether /boot/efi is on a partition or an md array.

> +            boot_disks = [ d.disk for d in boot_efi.parents ]

While this works for md arrays, it doesn't work for multipath
partitions. The generic form to get the list of disks that any device
resides on is device.disks. To get the list of disks that make up the
multipath on which the /boot/efi partition resides, you'd need something
like this:

 boot_disks = []
 for disk in boot_efi.disks:
  if disk.type == "dm-multipath":
   boot_disks.extend([p for p in disk.parents if p not in boot_disks])
  else:
   boot_disks.append(disk)

> +            boot_part_num = [ d.partedPartition.number for d in boot_efi.parents ]

This will be fine for md raid on grub1, but is not related to mpath
specifically.

> +            
> +        for boot_disk, boot_part_num in zip(boot_disks, boot_part_nums):
> +            boot_part_num = str(boot_part_num)
> +            rc = self.efibootmgr("-c", "-w", "-L", productName,
> +                                 "-d", boot_disk.path, "-p", boot_part_num,
> +                                 "-l", "\\EFI\\redhat\\grub.efi",
> +                                 root=ROOT_PATH,
> +                                 stdout="/dev/tty5", stderr="/dev/tty5")
> +            if rc:
> +                raise BootLoaderError("failed to set new efi boot target")
>  
>      def install(self):
>          self.remove_efi_boot_target()


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux