diff options
| author | Michael Still <mikal@stillhq.com> | 2012-10-23 14:25:25 -0700 |
|---|---|---|
| committer | Michael Still <mikal@stillhq.com> | 2012-10-25 09:20:46 +1100 |
| commit | 0d4e6dbe6f17d0a8d0f93833c1ea70f79944d945 (patch) | |
| tree | cdd80ba89da8567c5e1abc82a0ede862d6dd578d /nova/compute | |
| parent | 86b91474d16fb9842bb75dc7ebd1af364cc8a058 (diff) | |
Migrate to fileutils and lockutils.
Migrate nova to using openstack-common's file and lock utilities.
Resolves bug 1063230.
Change-Id: I1a4c87856bc08cd33b61d7098ed856baa4583654
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 7 | ||||
| -rw-r--r-- | nova/compute/resource_tracker.py | 11 |
2 files changed, 10 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6d19af6c7..c682f0fd6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -64,6 +64,7 @@ from nova.openstack.common import cfg from nova.openstack.common import excutils from nova.openstack.common import importutils from nova.openstack.common import jsonutils +from nova.openstack.common import lockutils from nova.openstack.common import log as logging from nova.openstack.common.notifier import api as notifier from nova.openstack.common import rpc @@ -844,7 +845,7 @@ class ComputeManager(manager.SchedulerDependentManager): if injected_files is None: injected_files = [] - @utils.synchronized(instance['uuid']) + @lockutils.synchronized(instance['uuid'], 'nova-') def do_run_instance(): self._run_instance(context, request_spec, filter_properties, requested_networks, injected_files, @@ -954,7 +955,7 @@ class ComputeManager(manager.SchedulerDependentManager): if not bdms: bdms = self._get_instance_volume_bdms(context, instance["uuid"]) - @utils.synchronized(instance['uuid']) + @lockutils.synchronized(instance['uuid'], 'nova-') def do_terminate_instance(instance, bdms): try: self._delete_instance(context, instance, bdms) @@ -2027,7 +2028,7 @@ class ComputeManager(manager.SchedulerDependentManager): @wrap_instance_fault def reserve_block_device_name(self, context, instance, device, volume_id): - @utils.synchronized(instance['uuid']) + @lockutils.synchronized(instance['uuid'], 'nova-') def do_reserve(): result = compute_utils.get_device_name_for_instance(context, instance, diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index 3105b3d6e..7acaa3dc1 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -27,6 +27,7 @@ from nova import notifications from nova.openstack.common import cfg from nova.openstack.common import importutils from nova.openstack.common import jsonutils +from nova.openstack.common import lockutils from nova.openstack.common import log as logging from nova import utils @@ -121,7 +122,7 @@ class ResourceTracker(object): claim = self.begin_resource_claim(context, instance_ref, limits) return ResourceContextManager(context, claim, self) - @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) + @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def begin_resource_claim(self, context, instance_ref, limits=None): """Indicate that some resources are needed for an upcoming compute instance build operation. @@ -293,7 +294,7 @@ class ResourceTracker(object): return can_claim_cpu - @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) + @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def finish_resource_claim(self, claim): """Indicate that the compute operation that previously claimed the resources identified by 'claim' has now completed and the resources @@ -308,7 +309,7 @@ class ResourceTracker(object): if self.claims.pop(claim.claim_id, None): LOG.debug(_("Finishing claim: %s") % claim) - @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) + @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def abort_resource_claim(self, context, claim): """Indicate that the operation that claimed the resources identified by 'claim_id' has either failed or been aborted and the resources are no @@ -328,7 +329,7 @@ class ResourceTracker(object): self._update_usage_from_instance(self.compute_node, claim.instance) self._update(context, self.compute_node) - @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) + @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def update_usage(self, context, instance): """Update the resource usage and stats after a change in an instance @@ -347,7 +348,7 @@ class ResourceTracker(object): def disabled(self): return self.compute_node is None - @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) + @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def update_available_resource(self, context): """Override in-memory calculations of compute node resource usage based on data audited from the hypervisor layer. |
