diff options
author | Phil Day <philip.day@hp.com> | 2013-01-31 17:08:17 +0000 |
---|---|---|
committer | Phil Day <philip.day@hp.com> | 2013-01-31 18:33:02 +0000 |
commit | cba2d8a637ba02e50816381eba5bcf6f1bfbe472 (patch) | |
tree | 23bee97a6c69712b8397f13f9323a3cd127cc371 | |
parent | 98e37e905349c576f0550bec15d65d101c8bce3e (diff) | |
download | nova-cba2d8a637ba02e50816381eba5bcf6f1bfbe472.tar.gz nova-cba2d8a637ba02e50816381eba5bcf6f1bfbe472.tar.xz nova-cba2d8a637ba02e50816381eba5bcf6f1bfbe472.zip |
instance.update notifications don't always identify the service
instance_update in conductor/manager.py doesn't identify the service
when calling notifications.send_update(), resulting in mesages on the
notification queue having a service value of None.
This change makes sure that the correct service is identified even
when running conductor in local mode
Change-Id: I1b22c0b46040f51ba715a4d9fa19ef4c98359070
-rw-r--r-- | nova/compute/api.py | 2 | ||||
-rw-r--r-- | nova/conductor/api.py | 5 | ||||
-rw-r--r-- | nova/conductor/manager.py | 7 | ||||
-rw-r--r-- | nova/conductor/rpcapi.py | 8 |
4 files changed, 14 insertions, 8 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index a9d0a1bdd..e4c885af1 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -186,7 +186,7 @@ class API(base.Base): (old_ref, instance_ref) = self.db.instance_update_and_get_original( context, instance_uuid, kwargs) - notifications.send_update(context, old_ref, instance_ref) + notifications.send_update(context, old_ref, instance_ref, 'api') return instance_ref diff --git a/nova/conductor/api.py b/nova/conductor/api.py index 710639305..83b58682b 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -80,7 +80,8 @@ class LocalAPI(object): def instance_update(self, context, instance_uuid, **updates): """Perform an instance update in the database.""" - return self._manager.instance_update(context, instance_uuid, updates) + return self._manager.instance_update(context, instance_uuid, + updates, 'compute') def instance_get(self, context, instance_id): return self._manager.instance_get(context, instance_id) @@ -354,7 +355,7 @@ class API(object): def instance_update(self, context, instance_uuid, **updates): """Perform an instance update in the database.""" return self.conductor_rpcapi.instance_update(context, instance_uuid, - updates) + updates, 'conductor') def instance_destroy(self, context, instance): return self.conductor_rpcapi.instance_destroy(context, instance) diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 232e9da3e..ca370731d 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -43,7 +43,7 @@ datetime_fields = ['launched_at', 'terminated_at'] class ConductorManager(manager.SchedulerDependentManager): """Mission: TBD.""" - RPC_API_VERSION = '1.37' + RPC_API_VERSION = '1.38' def __init__(self, *args, **kwargs): super(ConductorManager, self).__init__(service_name='conductor', @@ -56,7 +56,8 @@ class ConductorManager(manager.SchedulerDependentManager): exception.InvalidUUID, exception.InstanceNotFound, exception.UnexpectedTaskStateError) - def instance_update(self, context, instance_uuid, updates): + def instance_update(self, context, instance_uuid, + updates, service=None): for key, value in updates.iteritems(): if key not in allowed_updates: LOG.error(_("Instance update attempted for " @@ -67,7 +68,7 @@ class ConductorManager(manager.SchedulerDependentManager): old_ref, instance_ref = self.db.instance_update_and_get_original( context, instance_uuid, updates) - notifications.send_update(context, old_ref, instance_ref) + notifications.send_update(context, old_ref, instance_ref, service) return jsonutils.to_primitive(instance_ref) @rpc_common.client_exceptions(exception.InstanceNotFound) diff --git a/nova/conductor/rpcapi.py b/nova/conductor/rpcapi.py index 248a4e211..ce9face03 100644 --- a/nova/conductor/rpcapi.py +++ b/nova/conductor/rpcapi.py @@ -70,6 +70,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.35 - Added instance_get_active_by_window_joined 1.36 - Added instance_fault_create 1.37 - Added task_log_get, task_log_begin_task, task_log_end_task + 1.38 - Added service name to instance_update """ BASE_RPC_API_VERSION = '1.0' @@ -84,12 +85,15 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy): msg = self.make_msg('ping', arg=arg_p) return self.call(context, msg, version='1.22', timeout=timeout) - def instance_update(self, context, instance_uuid, updates): + def instance_update(self, context, instance_uuid, updates, + service=None): updates_p = jsonutils.to_primitive(updates) return self.call(context, self.make_msg('instance_update', instance_uuid=instance_uuid, - updates=updates_p)) + updates=updates_p, + service=service), + version='1.38') def instance_get(self, context, instance_id): msg = self.make_msg('instance_get', |