diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-05-14 12:00:23 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-14 12:00:23 +0000 |
| commit | 75af47a596b47674deec3867d81fabbea243d2a0 (patch) | |
| tree | 8cd4f3a627512e8feaeee4d30753340c82212d1c /nova/compute | |
| parent | 874e8203fab39fee955a5a3cc468a77a02049a62 (diff) | |
| parent | 3c36cbdbc83c1fe1e83fb0733101f84a7a61a0f7 (diff) | |
Merge "Hide lock_prefix argument using synchronized_with_prefix()"
Diffstat (limited to 'nova/compute')
| -rwxr-xr-x | nova/compute/manager.py | 9 | ||||
| -rw-r--r-- | nova/compute/resource_tracker.py | 14 |
2 files changed, 11 insertions, 12 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 8d5d8c962..79903f854 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -62,7 +62,6 @@ from nova.network import model as network_model from nova.network.security_group import openstack_driver from nova.openstack.common import excutils 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 periodic_task @@ -699,7 +698,7 @@ class ComputeManager(manager.SchedulerDependentManager): Synchronise the call beacuse we may still be in the middle of creating the instance. """ - @lockutils.synchronized(instance['uuid'], 'nova-') + @utils.synchronized(instance['uuid']) def _sync_refresh(): return self.driver.refresh_instance_security_rules(instance) return _sync_refresh() @@ -1313,7 +1312,7 @@ class ComputeManager(manager.SchedulerDependentManager): if filter_properties is None: filter_properties = {} - @lockutils.synchronized(instance['uuid'], 'nova-') + @utils.synchronized(instance['uuid']) def do_run_instance(): self._run_instance(context, request_spec, filter_properties, requested_networks, injected_files, @@ -1465,7 +1464,7 @@ class ComputeManager(manager.SchedulerDependentManager): if not bdms: bdms = self._get_instance_volume_bdms(context, instance) - @lockutils.synchronized(instance['uuid'], 'nova-') + @utils.synchronized(instance['uuid']) def do_terminate_instance(instance, bdms): try: self._delete_instance(context, instance, bdms, @@ -2928,7 +2927,7 @@ class ComputeManager(manager.SchedulerDependentManager): def reserve_block_device_name(self, context, instance, device, volume_id=None): - @lockutils.synchronized(instance['uuid'], 'nova-') + @utils.synchronized(instance['uuid']) def do_reserve(): bdms = self.conductor_api.block_device_mapping_get_all_by_instance( context, instance) diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index e5edfa564..ef91063b4 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -30,8 +30,8 @@ from nova import context from nova import exception 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 resource_tracker_opts = [ cfg.IntOpt('reserved_host_disk_mb', default=0, @@ -65,7 +65,7 @@ class ResourceTracker(object): self.tracked_migrations = {} self.conductor_api = conductor.API() - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def instance_claim(self, context, instance_ref, limits=None): """Indicate that some resources are needed for an upcoming compute instance build operation. @@ -115,7 +115,7 @@ class ResourceTracker(object): else: raise exception.ComputeResourcesUnavailable() - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def resize_claim(self, context, instance_ref, instance_type, limits=None): """Indicate that resources are needed for a resize operation to this compute host. @@ -183,7 +183,7 @@ class ResourceTracker(object): instance_ref['launched_on'] = self.host instance_ref['node'] = self.nodename - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def abort_instance_claim(self, instance): """Remove usage from the given instance.""" # flag the instance as deleted to revert the resource usage @@ -194,7 +194,7 @@ class ResourceTracker(object): ctxt = context.get_admin_context() self._update(ctxt, self.compute_node) - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def drop_resize_claim(self, instance, instance_type=None, prefix='new_'): """Remove usage for an incoming/outgoing migration.""" if instance['uuid'] in self.tracked_migrations: @@ -212,7 +212,7 @@ class ResourceTracker(object): ctxt = context.get_admin_context() self._update(ctxt, self.compute_node) - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def update_usage(self, context, instance): """Update the resource usage and stats after a change in an instance @@ -232,7 +232,7 @@ class ResourceTracker(object): def disabled(self): return self.compute_node is None - @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') + @utils.synchronized(COMPUTE_RESOURCE_SEMAPHORE) def update_available_resource(self, context): """Override in-memory calculations of compute node resource usage based on data audited from the hypervisor layer. |
