diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-07-02 21:36:17 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-07-02 21:36:17 +0000 |
commit | 74aa47a872325cce4b8de63a5751180c95b6ffcc (patch) | |
tree | a4ec19d49e3ca956cf72a846d0dc196d427bd0a2 /ironic/nova | |
parent | be5b79b9dff42c297d3d48d295e029e9f3a62872 (diff) | |
parent | b880153f078255eb770ff1bb79335f533b8dcac4 (diff) | |
download | ironic-74aa47a872325cce4b8de63a5751180c95b6ffcc.tar.gz |
Merge "Update Nova's available resources at termination"
Diffstat (limited to 'ironic/nova')
-rw-r--r-- | ironic/nova/compute/manager.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ironic/nova/compute/manager.py b/ironic/nova/compute/manager.py index b764e49a7..1e2d04f50 100644 --- a/ironic/nova/compute/manager.py +++ b/ironic/nova/compute/manager.py @@ -23,10 +23,14 @@ work. The goal here is to generalise the areas where n-c talking to a clustered hypervisor has issues, and long term fold them into the main ComputeManager. """ +from nova.openstack.common import lockutils from nova.compute import manager import nova.context +CCM_SEMAPHORE='clustered_compute_manager' + + class ClusteredComputeManager(manager.ComputeManager): def init_host(self): @@ -73,3 +77,23 @@ class ClusteredComputeManager(manager.ComputeManager): self.update_available_resource(nova.context.get_admin_context()) except Exception: pass + + @lockutils.synchronized(CCM_SEMAPHORE, 'ironic-') + def _update_resources(self): + """Updates resources while protecting against a race on + self._resource_tracker_dict. + """ + self.update_available_resource(nova.context.get_admin_context()) + + def terminate_instance(self, context, instance, bdms, reservations): + """Terminate an instance on a node. + + We override this method and force a post-termination update to Nova's + resources. This avoids having to wait for a Nova periodic task tick + before nodes can be reused. + """ + super(ClusteredComputeManager, self).terminate_instance(context, + instance, + bdms, + reservations) + self._update_resources() |