From ed11484b696e4af6f226029e88afe39277ea8e5e Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Thu, 19 Oct 2017 14:36:29 -0400 Subject: [PATCH] Don't update RT in _allocate_network The call to _update_resource_tracker from _allocate_network is a carryover from old times when _allocate_network would call _instance_update which would update the resource tracker generically for any state change in an instance. _update_resource_tracker calls rt.update_usage which grabs the COMPUTE_RESOURCE_SEMAPHORE lock which is the same lock used during claims and when the update_available_resource periodic task runs. The update_usage method can be a bit heavy weight if you're not actually changing anything the resource tracker cares about, because it's re-calculating stats for the capabilities scheduler filter and it's collecting new inventory from the virt driver and potentially updating that inventory for the compute node in placement. So given all _allocate_network is doing is changing the state on the instance, and the state it's changing to has nothing to do with what the resource tracker cares about (like deleting or shelve offloading an instance), we shouldn't call rt.update_usage and hold that big lock unnecessarily since it could hold up other operations happening at the same time, like creating instances. Closes-Bug: #1732316 Change-Id: Ib588c31a4d2075f8730409d50c99dfb04180a9cd (cherry picked from commit 7b0d5f7f347cb1c040595000d9d6987369dce2ab) --- nova/compute/manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 1d331e5bcfbb..63c12a9bc523 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1475,7 +1475,6 @@ class ComputeManager(manager.Manager): instance.vm_state = vm_states.BUILDING instance.task_state = task_states.NETWORKING instance.save(expected_task_state=[None]) - self._update_resource_tracker(context, instance) is_vpn = False return network_model.NetworkInfoAsyncWrapper(