Browse Source

Merge "Handle default_boot_mode during cleaning/inspection with PXE/iPXE"

changes/36/751636/1
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
235506b001
5 changed files with 26 additions and 5 deletions
  1. +3
    -2
      ironic/drivers/modules/boot_mode_utils.py
  2. +2
    -1
      ironic/drivers/modules/pxe_base.py
  3. +11
    -0
      ironic/tests/unit/drivers/modules/test_boot_mode_utils.py
  4. +1
    -2
      ironic/tests/unit/drivers/modules/test_pxe.py
  5. +9
    -0
      releasenotes/notes/pxe-boot-mode-9084ccf35e54bbc0.yaml

+ 3
- 2
ironic/drivers/modules/boot_mode_utils.py View File

@@ -284,7 +284,8 @@ def get_boot_mode(node):
return boot_mode
# TODO(hshiina): The default boot mode will be changed to UEFI.
global warn_about_default_boot_mode
if not warn_about_default_boot_mode:
if (not warn_about_default_boot_mode
and CONF.deploy.default_boot_mode == boot_modes.LEGACY_BIOS):
warn_about_default_boot_mode = True
LOG.warning('Boot mode is not configured for node %(node_uuid)s '
'explicitly. The default boot mode is "%(bios)s", but, '
@@ -294,4 +295,4 @@ def get_boot_mode(node):
{'node_uuid': node.uuid,
'bios': boot_modes.LEGACY_BIOS,
'uefi': boot_modes.UEFI})
return boot_modes.LEGACY_BIOS
return CONF.deploy.default_boot_mode

+ 2
- 1
ironic/drivers/modules/pxe_base.py View File

@@ -191,7 +191,8 @@ class PXEBaseMixin(object):
pxe_info.update(
pxe_utils.get_instance_image_info(
task, ipxe_enabled=self.ipxe_enabled))
boot_mode_utils.sync_boot_mode(task)

boot_mode_utils.sync_boot_mode(task)

pxe_options = pxe_utils.build_pxe_config_options(
task, pxe_info, ipxe_enabled=self.ipxe_enabled,


+ 11
- 0
ironic/tests/unit/drivers/modules/test_boot_mode_utils.py View File

@@ -53,3 +53,14 @@ class GetBootModeTestCase(tests_base.TestCase):
boot_mode = boot_mode_utils.get_boot_mode(self.node)
self.assertEqual(boot_modes.LEGACY_BIOS, boot_mode)
self.assertEqual(1, mock_log.warning.call_count)

@mock.patch.object(boot_mode_utils, 'LOG', autospec=True)
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy',
autospec=True)
def test_get_boot_mode_default_set(self, mock_for_deploy, mock_log):
self.config(default_boot_mode='uefi', group='deploy')
boot_mode_utils.warn_about_default_boot_mode = False
mock_for_deploy.return_value = None
boot_mode = boot_mode_utils.get_boot_mode(self.node)
self.assertEqual(boot_modes.UEFI, boot_mode)
self.assertEqual(0, mock_log.warning.call_count)

+ 1
- 2
ironic/tests/unit/drivers/modules/test_pxe.py View File

@@ -276,8 +276,7 @@ class PXEBootTestCase(db_base.DbTestCase):
mode=mode,
ipxe_enabled=False)
provider_mock.update_dhcp.assert_called_once_with(task, dhcp_opts)
if self.node.provision_state == states.DEPLOYING:
get_boot_mode_mock.assert_called_once_with(task)
get_boot_mode_mock.assert_called_once_with(task)
set_boot_device_mock.assert_called_once_with(task,
boot_devices.PXE,
persistent=persistent)


+ 9
- 0
releasenotes/notes/pxe-boot-mode-9084ccf35e54bbc0.yaml View File

@@ -0,0 +1,9 @@
---
fixes:
- |
Fixes cleaning and managed inspection not respecting the
``default_boot_mode`` configuration option.
- |
Fixes cleaning and managed inspection not following the standard boot
mode handling logic, particularly, not trying to assert the requested
boot mode if the driver allows it.

Loading…
Cancel
Save