summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-04-28 14:01:35 +0000
committerGerrit Code Review <review@openstack.org>2020-04-28 14:01:35 +0000
commit7bad00cfe94198f83fd41d92b721ccae3d848036 (patch)
treed70145631301b78c338132034b33acdcbb893036
parent656294f382a2e69079af7e3cae89671fa0c618e9 (diff)
parent39b485fcff1505615a2fa8a50b5e2fc6ec0cb66c (diff)
downloadironic-python-agent-5.0.2.tar.gz
Merge "Rescan after restarting the md device" into stable/train5.0.2
-rw-r--r--ironic_python_agent/extensions/image.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py
index 4ff3b4b9..c7ea9a33 100644
--- a/ironic_python_agent/extensions/image.py
+++ b/ironic_python_agent/extensions/image.py
@@ -350,16 +350,24 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None,
prep_boot_part_uuid=None):
"""Install GRUB2 bootloader on a given device."""
LOG.debug("Installing GRUB2 bootloader on device %s", device)
- root_partition = _get_partition(device, uuid=root_uuid)
+
efi_partition = None
efi_partition_mount_point = None
efi_mounted = False
+ # NOTE(TheJulia): Seems we need to get this before ever possibly
+ # restart the device in the case of multi-device RAID as pyudev
+ # doesn't exactly like the partition disappearing.
+ root_partition = _get_partition(device, uuid=root_uuid)
+
# If the root device is an md device (or partition), restart the device
# (to help grub finding it) and identify the underlying holder disks
# to install grub.
if hardware.is_md_device(device):
hardware.md_restart(device)
+ # If an md device, we need to rescan the devices anyway to pickup
+ # the md device partition.
+ _rescan_device(device)
elif (_is_bootloader_loaded(device)
and not (efi_system_part_uuid
or prep_boot_part_uuid)):