From 3907f8af4f2999ea3efcc77498b22b9e4732f728 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Wed, 5 Sep 2018 17:23:15 +0800 Subject: [PATCH] Remove inspecting state support from inspect_hardware Returning INSPECTING state from InspectInterface.inspect_hardware was deprecated and removed in this patch. This also removed the deprecated configuration option [conductor]inspect_timeout. Change-Id: I636e11a80451aa3a44d7f4b30295257d57028c34 Story: #1725211 Task: #26177 --- ironic/conductor/manager.py | 14 ++------------ ironic/conf/conductor.py | 1 - ironic/tests/unit/conductor/test_manager.py | 8 +++++--- ...-inspecting-state-support-10325bdcdd182079.yaml | 9 +++++++++ 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/remove-inspecting-state-support-10325bdcdd182079.yaml diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index 9bcf838b82..4e03dc98d7 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -3826,8 +3826,7 @@ def _do_inspect_hardware(task): :param: task: a TaskManager instance with an exclusive lock on its node. :raises: HardwareInspectionFailure if driver doesn't - return the state as states.MANAGEABLE, states.INSPECTWAIT or - states.INSPECTING. + return the state as states.MANAGEABLE, states.INSPECTWAIT. """ node = task.node @@ -3854,17 +3853,8 @@ def _do_inspect_hardware(task): task.process_event('done') LOG.info('Successfully inspected node %(node)s', {'node': node.uuid}) - # TODO(kaifeng): remove INSPECTING support during S* cycle. - elif new_state in (states.INSPECTING, states.INSPECTWAIT): + elif new_state == states.INSPECTWAIT: task.process_event('wait') - if new_state == states.INSPECTING: - inspect_intf_name = task.driver.inspect.__class__.__name__ - LOG.warning('Received INSPECTING state from %(intf)s. Returning ' - 'INSPECTING from InspectInterface.inspect_hardware ' - 'is deprecated, and will cause node be moved to ' - 'INSPECTFAIL state after deprecation period. Please ' - 'return INSPECTWAIT instead if the inspection process ' - 'is asynchronous.', {'intf': inspect_intf_name}) LOG.info('Successfully started introspection on node %(node)s', {'node': node.uuid}) else: diff --git a/ironic/conf/conductor.py b/ironic/conf/conductor.py index 3b2ae1d570..b2879bf458 100644 --- a/ironic/conf/conductor.py +++ b/ironic/conf/conductor.py @@ -124,7 +124,6 @@ opts = [ 'True.')), cfg.IntOpt('inspect_wait_timeout', default=1800, - deprecated_name='inspect_timeout', help=_('Timeout (seconds) for waiting for node inspection. ' '0 - unlimited.')), cfg.BoolOpt('automated_clean', diff --git a/ironic/tests/unit/conductor/test_manager.py b/ironic/tests/unit/conductor/test_manager.py index 9b7a39d8ef..923261d518 100644 --- a/ironic/tests/unit/conductor/test_manager.py +++ b/ironic/tests/unit/conductor/test_manager.py @@ -7014,11 +7014,13 @@ class NodeInspectHardware(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): provision_state=states.INSPECTING) task = task_manager.TaskManager(self.context, node.uuid) mock_inspect.return_value = states.INSPECTING - manager._do_inspect_hardware(task) + self.assertRaises(exception.HardwareInspectionFailure, + manager._do_inspect_hardware, task) + node.refresh() - self.assertEqual(states.INSPECTWAIT, node.provision_state) + self.assertIn('driver returned unexpected state', node.last_error) + self.assertEqual(states.INSPECTFAIL, node.provision_state) self.assertEqual(states.MANAGEABLE, node.target_provision_state) - self.assertIsNone(node.last_error) mock_inspect.assert_called_once_with(mock.ANY) @mock.patch('ironic.drivers.modules.fake.FakeInspect.inspect_hardware') diff --git a/releasenotes/notes/remove-inspecting-state-support-10325bdcdd182079.yaml b/releasenotes/notes/remove-inspecting-state-support-10325bdcdd182079.yaml new file mode 100644 index 0000000000..ef1eb61a03 --- /dev/null +++ b/releasenotes/notes/remove-inspecting-state-support-10325bdcdd182079.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - The deprecated configuration option ``[conductor]inspect_timeout`` was + removed, please use ``[conductor]inspect_wait_timeout`` instead. +other: + - The support for returning ``INSPECTING`` state from + ``InspectInterface.inspect_hardware`` was removed. For asynchronous + inspection, please return ``INSPECTWAIT`` instead of ``INSPECTING``, + otherwise the node will be moved to ``inspect failed`` state.