Don't break UEFI install with older IPAs

For Software RAID, we need to pass the boot mode to the IPA via a new
parameter. In case the IPA does not understand this new parameter yet,
we catch the error and fail for UEFI. This patch proposes to only fail
in the case of software RAID, since the older IPA can handle the general
case of UEFIi, e.g. with a whole disk image.

Change-Id: Id6b51dd19e83d20dc8d6d312cbec12d09bfd76c1
This commit is contained in:
Arne Wiebalck 2020-04-17 18:28:19 +02:00 committed by Julia Kreger
parent bfeef067aa
commit b417d0ffa0
3 changed files with 15 additions and 12 deletions

View File

@ -1095,7 +1095,8 @@ class AgentDeployMixin(HeartbeatMixin):
node, root_uuid=root_uuid,
efi_system_part_uuid=efi_system_part_uuid,
prep_boot_part_uuid=prep_boot_part_uuid,
target_boot_mode=target_boot_mode
target_boot_mode=target_boot_mode,
software_raid=software_raid
)
if result['command_status'] == 'FAILED':
if not whole_disk_image:

View File

@ -276,7 +276,8 @@ class AgentClient(object):
@METRICS.timer('AgentClient.install_bootloader')
def install_bootloader(self, node, root_uuid, target_boot_mode,
efi_system_part_uuid=None,
prep_boot_part_uuid=None):
prep_boot_part_uuid=None,
software_raid=False):
"""Install a boot loader on the image.
:param node: A node object.
@ -315,12 +316,12 @@ class AgentClient(object):
wait=True,
command_timeout_factor=2)
except exception.AgentAPIError:
# NOTE(arne_wiebalck): If we require to pass 'uefi' as the boot
# mode, but find that the IPA does not yet support the additional
# NOTE(arne_wiebalck): If for software RAID and 'uefi' as the boot
# mode, we find that the IPA does not yet support the additional
# 'target_boot_mode' parameter, we need to fail. For 'bios' boot
# mode on the other hand we can retry without the parameter,
# since 'bios' is the default value the IPA will use.
if target_boot_mode == 'uefi':
if target_boot_mode == 'uefi' and software_raid:
LOG.error('Unable to pass UEFI boot mode to an out of date '
'agent ramdisk. Please contact the administrator '
'to update the ramdisk to contain an '

View File

@ -1101,7 +1101,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid='some-root-uuid',
efi_system_part_uuid=None, prep_boot_part_uuid=None,
target_boot_mode='whatever'
target_boot_mode='whatever', software_raid=False
)
@mock.patch.object(agent_client.AgentClient, 'install_bootloader',
@ -1126,7 +1126,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid='some-root-uuid',
efi_system_part_uuid=None, prep_boot_part_uuid='fake-prep',
target_boot_mode='whatever'
target_boot_mode='whatever', software_raid=False
)
@mock.patch.object(agent_client.AgentClient, 'install_bootloader',
@ -1152,7 +1152,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
mock.ANY, task.node, root_uuid='some-root-uuid',
efi_system_part_uuid='efi-system-part-uuid',
prep_boot_part_uuid=None,
target_boot_mode='uefi'
target_boot_mode='uefi', software_raid=False
)
@mock.patch.object(deploy_utils, 'try_set_boot_device', autospec=True)
@ -1199,7 +1199,8 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid=None,
efi_system_part_uuid='efi-system-part-uuid',
prep_boot_part_uuid=None, target_boot_mode='uefi')
prep_boot_part_uuid=None, target_boot_mode='uefi',
software_raid=False)
@mock.patch.object(image_service, 'GlanceImageService', autospec=True)
@mock.patch.object(deploy_utils, 'try_set_boot_device', autospec=True)
@ -1264,7 +1265,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid=root_uuid,
efi_system_part_uuid=None, prep_boot_part_uuid=None,
target_boot_mode='bios')
target_boot_mode='bios', software_raid=True)
try_set_boot_device_mock.assert_called_once_with(
task, boot_devices.DISK, persistent=True)
@ -1366,7 +1367,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid='some-root-uuid',
efi_system_part_uuid=None, prep_boot_part_uuid=None,
target_boot_mode='whatever'
target_boot_mode='whatever', software_raid=False
)
collect_logs_mock.assert_called_once_with(mock.ANY, task.node)
self.assertEqual(states.DEPLOYFAIL, task.node.provision_state)
@ -1399,7 +1400,7 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
install_bootloader_mock.assert_called_once_with(
mock.ANY, task.node, root_uuid='some-root-uuid',
efi_system_part_uuid=None, prep_boot_part_uuid=None,
target_boot_mode='whatever')
target_boot_mode='whatever', software_raid=False)
try_set_boot_device_mock.assert_called_once_with(
task, boot_devices.DISK, persistent=True)
collect_logs_mock.assert_called_once_with(mock.ANY, task.node)