diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py index 3f8eca953e..c496076488 100644 --- a/ironic/common/pxe_utils.py +++ b/ironic/common/pxe_utils.py @@ -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, diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py index 27d08ecf55..55661cd6d4 100644 --- a/ironic/tests/unit/common/test_pxe_utils.py +++ b/ironic/tests/unit/common/test_pxe_utils.py @@ -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) diff --git a/releasenotes/notes/bug-2069413-fc9262c573f2fe10.yaml b/releasenotes/notes/bug-2069413-fc9262c573f2fe10.yaml new file mode 100644 index 0000000000..6a97ada43a --- /dev/null +++ b/releasenotes/notes/bug-2069413-fc9262c573f2fe10.yaml @@ -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.