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

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

 



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":
+            boot_disks = [ d.disk for d in boot_efi.parents ]
+            boot_part_num = [ d.partedPartition.number for d in boot_efi.parents ]
+            
+        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()
-- 
1.7.4.4

_______________________________________________
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