Add 'inspect wait' as a valid state

ironic-inspector checks node provision state before starting hardware
introspection, to allow inspection for node at inspect wait state,
this state has to be added to ironic-inspector.

Story: #1725211
Task: #11372
Change-Id: I89d9dfb85e191e781d869374911950d322fc227e
Partial-Bug: #1725211
This commit is contained in:
Kaifeng Wang 2018-03-22 16:16:34 +08:00
parent 093ceb5c62
commit f257c57177
2 changed files with 13 additions and 2 deletions

View File

@ -26,8 +26,9 @@ from ironic_inspector import utils
CONF = cfg.CONF
LOG = utils.getProcessingLogger(__name__)
# See http://specs.openstack.org/openstack/ironic-specs/specs/kilo/new-ironic-state-machine.html # noqa
VALID_STATES = {'enroll', 'manageable', 'inspecting', 'inspect failed'}
# See https://docs.openstack.org/ironic/latest/contributor/states.html # noqa
VALID_STATES = {'enroll', 'manageable', 'inspecting', 'inspect wait',
'inspect failed'}
# 1.19 is API version, which supports port.pxe_enabled
DEFAULT_IRONIC_API_VERSION = '1.19'

View File

@ -263,6 +263,16 @@ class TestIntrospect(BaseTest):
self.assertFalse(start_mock.called)
self.assertFalse(self.node_info.acquire_lock.called)
def test_inspect_wait_state_allowed(self, client_mock, start_mock):
self.node.provision_state = 'inspect wait'
cli = client_mock.return_value
cli.node.get.return_value = self.node
cli.node.validate.return_value = mock.Mock(power={'result': True})
introspect.introspect(self.uuid)
self.assertTrue(start_mock.called)
@mock.patch.object(time, 'time')
def test_introspection_delay(self, time_mock, client_mock, start_mock):
time_mock.return_value = 42