From df7aca88693e6435bbfc12ad06aa9d5d62399c69 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 4 Dec 2012 11:50:56 -0500 Subject: Use conductor for resourcetracker instance_update. Use the instance_update method on the conductor service for issuing instance update requests from the compute resource tracker. Notifications are sent out by conductor, so that was removed from the resource tracker. The conductor now also accepts 'launched_on' as a valid key. A duplicate 'host' key in the list of valid keys was removed. Part of blueprint no-db-compute. Change-Id: Id4858cc2ab0d128107ea311e2ababef51c2ded83 --- nova/compute/resource_tracker.py | 7 ++++--- nova/conductor/manager.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index 07e839857..0767b4e61 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -23,6 +23,7 @@ from nova.compute import claims from nova.compute import instance_types from nova.compute import task_states from nova.compute import vm_states +from nova import conductor from nova import context from nova import db from nova import exception @@ -63,6 +64,7 @@ class ResourceTracker(object): self.stats = importutils.import_object(CONF.compute_stats_class) self.tracked_instances = {} self.tracked_migrations = {} + self.conductor_api = conductor.API() @lockutils.synchronized(COMPUTE_RESOURCE_SEMAPHORE, 'nova-') def instance_claim(self, context, instance_ref, limits=None): @@ -183,9 +185,8 @@ class ResourceTracker(object): """ values = {'host': self.host, 'node': self.nodename, 'launched_on': self.host} - (old_ref, new_ref) = db.instance_update_and_get_original(context, - instance_ref['uuid'], values) - notifications.send_update(context, old_ref, new_ref) + self.conductor_api.instance_update(context, instance_ref['uuid'], + **values) instance_ref['host'] = self.host instance_ref['launched_on'] = self.host diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 53a3dc745..824875b3c 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -29,7 +29,7 @@ allowed_updates = ['task_state', 'vm_state', 'expected_task_state', 'power_state', 'access_ip_v4', 'access_ip_v6', 'launched_at', 'terminated_at', 'host', 'node', 'memory_mb', 'vcpus', 'root_gb', 'ephemeral_gb', - 'instance_type_id', 'root_device_name', 'host', + 'instance_type_id', 'root_device_name', 'launched_on', 'progress', 'vm_mode', 'default_ephemeral_device', 'default_swap_device', 'root_device_name', ] -- cgit