FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-05-2012, 08:47 AM
Martin Sivak
 
Default Fix EFI boot from multipath (forward port of #691794)

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
edhatgrub.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
edhatgrub.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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-05-2012, 03:46 PM
David Cantrell
 
Default Fix EFI boot from multipath (forward port of #691794)

Ack. Make sure the bz reference in the first line is just (#______)

On Mon, Mar 05, 2012 at 10:47:43AM +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
edhatgrub.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
edhatgrub.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@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-05-2012, 03:48 PM
David Lehman
 
Default Fix EFI boot from multipath (forward port of #691794)

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
edhatgrub.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
edhatgrub.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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 12:59 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org