Build PXE config for node in SERVICING state

When [pxe]enable_netboot_fallback option is enabled, it's necessary to
build PXE config for nodes in SERVICING provisioning state. Otherwise
node servicing tear down will fail and node will be placed into
servicing failed state.

Closes-Bug: #2069413

Change-Id: Ib00504563f9fa7bed99a0fa1949ac99ea6870875
Signed-off-by: Przemyslaw Szczerbik <przemyslaw.szczerbik@intel.com>
This commit is contained in:
Przemyslaw Szczerbik 2024-05-24 02:23:28 -07:00
parent ebbc8300c3
commit 78f54dfefa
3 changed files with 30 additions and 1 deletions

View File

@ -1014,7 +1014,8 @@ def build_service_pxe_config(task, instance_image_info,
# fail if the agent was booted outside the direct actions of the
# boot interface.
if (node.provision_state in [states.ACTIVE, states.UNRESCUING,
states.DEPLOYING, states.ADOPTING]
states.DEPLOYING, states.ADOPTING,
states.SERVICING]
and not os.path.isfile(pxe_config_path)):
pxe_options = build_pxe_config_options(task, instance_image_info,
service=True,

View File

@ -2598,6 +2598,27 @@ class iPXEBuildServicePXEConfigTestCase(db_base.DbTestCase):
mock_pxe_utils.assert_called()
mock_switch.assert_called()
@mock.patch.object(pxe_utils, 'create_pxe_config', autospec=True)
@mock.patch.object(deploy_utils, 'switch_pxe_config', autospec=True)
def test_build_service_pxe_config_servicing(self, mock_switch,
mock_pxe_utils):
self.node.provision_state = states.SERVICING
driver_internal_info = self.node.driver_internal_info
driver_internal_info['is_whole_disk_image'] = True
self.node.driver_internal_info = driver_internal_info
self.node.save()
image_info = {}
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:
pxe_utils.build_service_pxe_config(task, image_info, 'id',
is_whole_disk_image=True)
mock_pxe_utils.assert_called()
mock_switch.assert_called()
@mock.patch.object(ironic_utils, 'unlink_without_raise', autospec=True)
@mock.patch.object(pxe_utils, 'clean_up_pxe_config', autospec=True)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
[`bug 2069413 <https://bugs.launchpad.net/ironic/+bug/2069413>`_]
Fixes an issue with node servicing that caused node to be put into
'service failed' state when Ironic configuration option
[pxe]enable_netboot_fallback was enabled.