Return false for MBR bootloader check on UEFI machines
Somewhat common are dual boot images that have both a MBR loader and the contents required for a UEFI boot, as largely the pointer to where to begin reading the rest of the boot loader occurs in the first few hundred bytes on disk which redirects the disk to begin reading from a known address. This goes sideways on UEFI machines where this method of booting is not recognized nor supported. Thus we need to return false when we encounter this state. Change-Id: I8c0b42bb71b9e26ed7fec8894e21ce7fc06b94a1 Story: 2007455 Task: 39133
This commit is contained in:
parent
e2f6dcad4e
commit
81137d4045
@ -168,6 +168,14 @@ def _is_bootloader_loaded(dev):
|
||||
return True
|
||||
return False
|
||||
|
||||
boot = hardware.dispatch_to_managers('get_boot_info')
|
||||
|
||||
if boot.current_boot_mode != 'bios':
|
||||
# We're in UEFI mode, this logic is invalid
|
||||
LOG.debug('Skipping boot sector check as the system is in UEFI '
|
||||
'boot mode.')
|
||||
return False
|
||||
|
||||
try:
|
||||
# Looking for things marked "bootable" in the partition table
|
||||
stdout, stderr = utils.execute('parted', dev, '-s', '-m',
|
||||
|
@ -704,6 +704,8 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
|
||||
|
||||
def test__is_bootloader_loaded(self, mock_execute,
|
||||
mock_dispatch):
|
||||
mock_dispatch.return_value = hardware.BootInfo(
|
||||
current_boot_mode='bios')
|
||||
parted_output = ('BYT;\n'
|
||||
'/dev/loop1:46.1MB:loopback:512:512:gpt:Loopback '
|
||||
'device:;\n'
|
||||
@ -758,6 +760,16 @@ efibootmgr: ** Warning ** : Boot0005 has same label ironic1\n
|
||||
result = image._is_bootloader_loaded(self.fake_dev)
|
||||
self.assertFalse(result)
|
||||
|
||||
def test__is_bootloader_loaded_uefi_mode(self, mock_execute,
|
||||
mock_dispatch):
|
||||
|
||||
mock_dispatch.return_value = hardware.BootInfo(
|
||||
current_boot_mode='uefi')
|
||||
result = image._is_bootloader_loaded(self.fake_dev)
|
||||
self.assertFalse(result)
|
||||
mock_dispatch.assert_any_call('get_boot_info')
|
||||
self.assertEqual(0, mock_execute.call_count)
|
||||
|
||||
@mock.patch.object(image, '_get_partition', autospec=True)
|
||||
@mock.patch.object(utils, 'get_efi_part_on_device', autospec=True)
|
||||
def test__manage_uefi_no_partition(self, mock_utils_efi_part,
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue with deployment ramdisks running in UEFI boot mode where
|
||||
dual-boot images may cause the logic to prematurely exit before UEFI
|
||||
parameters can be updated. Internal checks for a BIOS bootloader will
|
||||
always return ``False`` now when the machine is in UEFI mode.
|
Loading…
Reference in New Issue
Block a user