diff --git a/ironic/api/controllers/v1/node.py b/ironic/api/controllers/v1/node.py index c34cfc1ec5..eae57f9ed4 100644 --- a/ironic/api/controllers/v1/node.py +++ b/ironic/api/controllers/v1/node.py @@ -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}) diff --git a/ironic/tests/unit/api/v1/test_nodes.py b/ironic/tests/unit/api/v1/test_nodes.py index 5e26b5d6ea..40b9f7f188 100644 --- a/ironic/tests/unit/api/v1/test_nodes.py +++ b/ironic/tests/unit/api/v1/test_nodes.py @@ -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, diff --git a/releasenotes/notes/no-instance-uuid-workaround-fc458deb168c7a8b.yaml b/releasenotes/notes/no-instance-uuid-workaround-fc458deb168c7a8b.yaml new file mode 100644 index 0000000000..52caa8ee4b --- /dev/null +++ b/releasenotes/notes/no-instance-uuid-workaround-fc458deb168c7a8b.yaml @@ -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.