Remove workaround for nova removing instance_uuid during cleaning

Was supposed to be removed back in Mitaka, according to the comments.

Change-Id: I1974b3694ed8d43a22f1f211e3f665adcf04fec6
This commit is contained in:
Dmitry Tantsur 2016-06-13 11:47:47 +02:00
parent 09f87fb175
commit 5203bf05d0
3 changed files with 5 additions and 29 deletions

View File

@ -1266,18 +1266,8 @@ class NodesController(rest.RestController):
rpc_node = api_utils.get_rpc_node(node_ident)
# TODO(lucasagomes): This code is here for backward compatibility
# with old nova Ironic drivers that will attempt to remove the
# instance even if it's already deleted in Ironic. This conditional
# should be removed in the next cycle (Mitaka).
remove_inst_uuid_patch = [{'op': 'remove', 'path': '/instance_uuid'}]
if (rpc_node.provision_state in (ir_states.CLEANING,
ir_states.CLEANWAIT)
and patch == remove_inst_uuid_patch):
# The instance_uuid is already removed as part of the node's
# tear down, skip this update.
return Node.convert_with_links(rpc_node)
elif rpc_node.maintenance and patch == remove_inst_uuid_patch:
if rpc_node.maintenance and patch == remove_inst_uuid_patch:
LOG.debug('Removing instance uuid %(instance)s from node %(node)s',
{'instance': rpc_node.instance_uuid,
'node': rpc_node.uuid})

View File

@ -1086,24 +1086,6 @@ class TestPatch(test_api_base.BaseApiTest):
self.assertEqual(http_client.BAD_REQUEST, response.status_code)
self.assertTrue(response.json['error_message'])
def test_remove_instance_uuid_clean_backward_compat(self):
for state in (states.CLEANING, states.CLEANWAIT):
node = obj_utils.create_test_node(
self.context,
uuid=uuidutils.generate_uuid(),
provision_state=state,
target_provision_state=states.AVAILABLE)
self.mock_update_node.return_value = node
response = self.patch_json('/nodes/%s' % node.uuid,
[{'op': 'remove',
'path': '/instance_uuid'}])
self.assertEqual('application/json', response.content_type)
self.assertEqual(http_client.OK, response.status_code)
# NOTE(lucasagomes): instance_uuid is already removed as part of
# node's tear down, assert update has not been called. This test
# should be removed in the next cycle (Mitaka).
self.assertFalse(self.mock_update_node.called)
def test_add_state_in_cleaning(self):
node = obj_utils.create_test_node(
self.context,

View File

@ -0,0 +1,4 @@
---
upgrade:
- Removed the workaround in API allowing removing "instance_uuid" during
cleaning. It was only required for Nova during introduction of cleaning.