Update resources only for specific node during deletion.

At the moment during Nova instance termination resources are
updated for all Ironic nodes. As result with high number of nodes,
removing N instances initiates N x M requests, where M is the total
number of nodes. This commit allows to update resources per specific
node on termination.

Depends-On: Iffad4a6ab1aaa5fea591c19f6d330dc861c5675d

Change-Id: Ib54741c8564e18f23c4f50bed190dfc66db7ba76
Closes-Bug: #1552446
This commit is contained in:
vsaienko 2016-03-03 01:07:33 +02:00 committed by Vasyl Saienko
parent 982c9a97ab
commit 16d8819891
2 changed files with 12 additions and 5 deletions

View File

@ -81,13 +81,15 @@ class ClusteredComputeManager(manager.ComputeManager):
pass
@lockutils.synchronized(CCM_SEMAPHORE, 'ironic-')
def _update_resources(self):
"""Update our resources
def _update_resources(self, node_uuid):
"""Update the specified node resource
Updates the resources while protecting against a race on
Updates the resources for instance while protecting against a race on
self._resource_tracker_dict.
:param node_uuid: UUID of the Ironic node to update resources for.
"""
self.update_available_resource(nova.context.get_admin_context())
self.update_available_resource_for_node(
nova.context.get_admin_context(), node_uuid)
def terminate_instance(self, context, instance, bdms, reservations):
"""Terminate an instance on a node.
@ -100,4 +102,4 @@ class ClusteredComputeManager(manager.ComputeManager):
instance,
bdms,
reservations)
self._update_resources()
self._update_resources(instance.node)

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixed performance issue for 'ironic.nova.compute.ClusteredComputeManager'
when during Nova instance termination resources were updated for all
Nova hypervisors.