From 754847ed277e2b00f2002e227cf1d026149d1d43 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 14 Mar 2019 18:00:52 +0000 Subject: [PATCH] trivial: Remove dead resource tracker code Change-Id: I7ad261e60517858cec02f20df2ff0db2f0af0c62 Signed-off-by: Stephen Finucane --- nova/compute/resource_tracker.py | 36 ++----------------------- nova/tests/unit/compute/test_compute.py | 4 +-- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index 5794d536c06e..8e6a4eb99162 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -1391,45 +1391,13 @@ class ResourceTracker(object): def delete_allocation_for_evacuated_instance(self, context, instance, node, node_type='source'): - self._delete_allocation_for_moved_instance( - context, instance, node, 'evacuated', node_type) - - def delete_allocation_for_migrated_instance(self, context, instance, node): - self._delete_allocation_for_moved_instance(context, instance, node, - 'migrated') - - def _delete_allocation_for_moved_instance( - self, context, instance, node, move_type, node_type='source'): # Clean up the instance allocation from this node in placement cn_uuid = self.compute_nodes[node].uuid if not self.reportclient.remove_provider_tree_from_instance_allocation( context, instance.uuid, cn_uuid): - LOG.error("Failed to clean allocation of %s " + LOG.error("Failed to clean allocation of evacuated " "instance on the %s node %s", - move_type, node_type, cn_uuid, instance=instance) - - def delete_allocation_for_failed_resize(self, context, instance, node, - flavor): - """Delete instance allocations for the node during a failed resize - - :param context: The request context. - :param instance: The instance being resized/migrated. - :param node: The node provider on which the instance should have - allocations to remove. If this is a resize to the same host, then - the new_flavor resources are subtracted from the single allocation. - :param flavor: This is the new_flavor during a resize. - """ - cn = self.compute_nodes[node] - if not self.reportclient.remove_provider_tree_from_instance_allocation( - context, instance.uuid, cn.uuid): - if instance.instance_type_id == flavor.id: - operation = 'migration' - else: - operation = 'resize' - LOG.error('Failed to clean allocation after a failed ' - '%(operation)s on node %(node)s', - {'operation': operation, 'node': cn.uuid}, - instance=instance) + node_type, cn_uuid, instance=instance) def _find_orphaned_instances(self): """Given the set of instances and migrations already account for diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index b990643eb19a..a82cded2b60b 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -6669,13 +6669,11 @@ class ComputeTestCase(BaseTestCase, '_get_instance_block_device_info'), mock.patch.object(self.compute.driver, 'get_volume_connector'), mock.patch.object(cinder.API, 'terminate_connection'), - mock.patch('nova.compute.resource_tracker.ResourceTracker.' - 'delete_allocation_for_migrated_instance'), ) as ( migrate_instance_start, post_live_migration_at_destination, setup_networks_on_host, clear_events_for_instance, get_instance_volume_block_device_info, get_volume_connector, - terminate_connection, delete_alloc, + terminate_connection, ): get_volume_connector.return_value = 'fake-connector'