[anaconda:master] Patches to allow /boot to be RAID1 with EFI (#791136)
David Lehman
dlehman at redhat.com
Wed Jun 25 13:31:25 UTC 2014
On 06/24/2014 02:49 PM, mulhern wrote:
> Resolves: rhbz#791136
>
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> pyanaconda/bootloader.py | 20 ++++++++++----------
> pyanaconda/storage_utils.py | 2 +-
> pyanaconda/ui/gui/spokes/custom.py | 9 +++++----
> 3 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
> index c0e34da..41a906f 100644
> --- a/pyanaconda/bootloader.py
> +++ b/pyanaconda/bootloader.py
> @@ -1713,16 +1713,9 @@ class EFIGRUB(GRUB2):
> ret = self._config_dir.replace('efi/', '')
> return "\\" + ret.replace('/', '\\')
>
> - def add_efi_boot_target(self):
> - if self.stage1_device.type == "partition":
> - boot_disk = self.stage1_device.disk
> - boot_part_num = self.stage1_device.partedPartition.number
> - elif self.stage1_device.type == "mdarray":
> - # FIXME: I'm just guessing here. This probably needs the full
> - # treatment, ie: multiple targets for each member.
> - boot_disk = self.stage1_device.parents[0].disk
> - boot_part_num = self.stage1_device.parents[0].partedPartition.number
> - boot_part_num = str(boot_part_num)
> + def _add_single_efi_boot_target(self, disk):
> + boot_disk = disk.disk
> + boot_part_num = disk.partedPartition.number
Calling the partition "disk" is pretty confusing. It would be much
clearer if it were named "partition" instead. Otherwise this and the
blivet set look good to me.
David
>
> rc = self.efibootmgr("-c", "-w", "-L", productName,
> "-d", boot_disk.path, "-p", boot_part_num,
> @@ -1732,6 +1725,13 @@ class EFIGRUB(GRUB2):
> if rc:
> raise BootLoaderError("failed to set new efi boot target. This is most likely a kernel bug.")
>
> + def add_efi_boot_target(self):
> + if self.stage1_device.type == "partition":
> + self._add_single_efi_boot_target(self.stage1_device)
> + elif self.stage1_device.type == "mdarray":
> + for parent in self.stage1_device.parents:
> + self._add_single_efi_boot_target(parent)
> +
> def install(self, args=None):
> if not flags.leavebootorder:
> self.remove_efi_boot_target()
> diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py
> index fb66e8f..e6e3f70 100644
> --- a/pyanaconda/storage_utils.py
> +++ b/pyanaconda/storage_utils.py
> @@ -55,7 +55,7 @@ DEVICE_TEXT_MAP = {DEVICE_TYPE_LVM: DEVICE_TEXT_LVM,
> DEVICE_TYPE_LVM_THINP: DEVICE_TEXT_LVM_THINP,
> DEVICE_TYPE_DISK: DEVICE_TEXT_DISK}
>
> -PARTITION_ONLY_FORMAT_TYPES = ("efi", "macefi", "prepboot", "biosboot", "appleboot")
> +PARTITION_ONLY_FORMAT_TYPES = ("macefi", "prepboot", "biosboot", "appleboot")
>
> MOUNTPOINT_DESCRIPTIONS = {"Swap": N_("The 'swap' area on your computer is used by the operating\n"
> "system when running low on memory."),
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index 18c1759..83c7f1a 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -63,7 +63,7 @@ from blivet.devicelibs import raid
> from blivet.devices import LUKSDevice
>
> from pyanaconda.storage_utils import ui_storage_logger, device_type_from_autopart
> -from pyanaconda.storage_utils import DEVICE_TEXT_PARTITION, DEVICE_TEXT_MAP
> +from pyanaconda.storage_utils import DEVICE_TEXT_PARTITION, DEVICE_TEXT_MAP, DEVICE_TEXT_MD
> from pyanaconda.storage_utils import PARTITION_ONLY_FORMAT_TYPES, MOUNTPOINT_DESCRIPTIONS
> from pyanaconda.storage_utils import NAMED_DEVICE_TYPES, CONTAINER_DEVICE_TYPES
>
> @@ -617,9 +617,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> :param raid_level: instance of blivet.devicelibs.raid.RAIDLevel or None
> """
> error = None
> - if device_type != DEVICE_TYPE_PARTITION and mountpoint == "/boot/efi":
> - error = (_("/boot/efi must be on a device of type %s")
> - % _(DEVICE_TEXT_PARTITION))
> + if device_type not in (DEVICE_TYPE_PARTITION, DEVICE_TYPE_MD) and \
> + mountpoint == "/boot/efi":
> + error = (_("/boot/efi must be on a device of type %s or %s")
> + % (_(DEVICE_TEXT_PARTITION), _(DEVICE_TEXT_MD)))
> elif device_type != DEVICE_TYPE_PARTITION and \
> new_fs_type in PARTITION_ONLY_FORMAT_TYPES:
> error = (_("%(fs)s must be on a device of type %(type)s")
>
More information about the anaconda-patches
mailing list