Allow to unprovision instance from service wait states
There is an unalignement between service/rescue operations in state transition, currently we don't have such route from service* to deleting. When a node is in service* states, request to destroy the instance will clean up part of resources and leave ironic node at unexpected state, without proper clean up. Unprovision from service failed is addressed by https://review.opendev.org/c/openstack/ironic/+/944966 This patch fix unprovisioning from the service wait state. Change-Id: Ib2d2e7ad9deb1e7011f60bc9b55224ebd7c153e3 Closes-Bug: 2087523
This commit is contained in:
@@ -667,5 +667,8 @@ machine.add_transition(SERVICEFAIL, SERVICING, 'service')
|
||||
# A node in service fail can be rescued
|
||||
machine.add_transition(SERVICEFAIL, RESCUING, 'rescue')
|
||||
|
||||
# A no in service fail may be deleted.
|
||||
# A node in service fail may be deleted.
|
||||
machine.add_transition(SERVICEFAIL, DELETING, 'delete')
|
||||
|
||||
# A node in service wait may be deleted.
|
||||
machine.add_transition(SERVICEWAIT, DELETING, 'delete')
|
||||
|
@@ -6229,6 +6229,23 @@ ORHMKeXMO8fcK0By7CiMKwHSXCoEQgfQhWwpMdSsO8LgHCjh87DQc= """
|
||||
self.assertEqual(urlparse.urlparse(ret.location).path,
|
||||
expected_location)
|
||||
|
||||
def test_provision_with_unprovision_in_service_wait(self):
|
||||
node = self.node
|
||||
node.provision_state = states.SERVICEWAIT
|
||||
node.target_provision_state = states.ACTIVE
|
||||
node.save()
|
||||
ret = self.put_json('/nodes/%s/states/provision' % node.uuid,
|
||||
{'target': states.DELETED})
|
||||
self.assertEqual(http_client.ACCEPTED, ret.status_code)
|
||||
self.assertEqual(b'', ret.body)
|
||||
self.mock_dntd.assert_called_once_with(
|
||||
mock.ANY, mock.ANY, node.uuid, 'test-topic')
|
||||
# Check location header
|
||||
self.assertIsNotNone(ret.location)
|
||||
expected_location = '/v1/nodes/%s/states' % node.uuid
|
||||
self.assertEqual(urlparse.urlparse(ret.location).path,
|
||||
expected_location)
|
||||
|
||||
@mock.patch.object(rpcapi.ConductorAPI, 'do_provisioning_action',
|
||||
autospec=True)
|
||||
def test_provide_from_manage(self, mock_dpa):
|
||||
|
@@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add support for a node in ``service wait`` state can be unprovisioned
|
||||
via the ``delete`` provision action.
|
Reference in New Issue
Block a user