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
This commit is contained in:
Kaifeng Wang 2018-09-05 17:23:15 +08:00
parent c82749631c
commit 3907f8af4f
4 changed files with 16 additions and 16 deletions

View File

@ -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:

View File

@ -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',

View File

@ -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')

View File

@ -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.