diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-27 15:39:29 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-30 20:18:38 -0400 |
| commit | 4b3ca6fbf3e89adfd92bdfcd02768f50152e68cf (patch) | |
| tree | 4088e61f324216bdd0de7518d9f03383035363f5 /nova/compute | |
| parent | 697f2bddf0e21368c69f13d0ec4e43df17d7f330 (diff) | |
Send a full instance in reset_network.
Change the reset_network method of the compute
rpc API to take a full instance over rpc instead of just
the instance UUID. This cuts down on database access needed
by nova-compute.
Part of blueprint no-db-messaging.
Change-Id: Iaae16e63da9d48d86e3bfc80f6c0cdb9f9bd3ddd
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 11 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 09c82035f..e56d0c0c4 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -272,7 +272,7 @@ def _get_image_meta(context, image_ref): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '1.27' + RPC_API_VERSION = '1.28' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1676,7 +1676,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_id) network_info = self._inject_network_info(context, instance=instance) - self.reset_network(context, instance['uuid']) + self.reset_network(context, instance) self._notify_about_instance_usage( context, instance, "create_ip.end", network_info=network_info) @@ -1701,7 +1701,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self._inject_network_info(context, instance=instance) - self.reset_network(context, instance['uuid']) + self.reset_network(context, instance) self._notify_about_instance_usage( context, instance, "delete_ip.end", network_info=network_info) @@ -1860,9 +1860,10 @@ class ComputeManager(manager.SchedulerDependentManager): @checks_instance_lock @wrap_instance_fault - def reset_network(self, context, instance_uuid): + def reset_network(self, context, instance=None, instance_uuid=None): """Reset networking on the given instance.""" - instance = self.db.instance_get_by_uuid(context, instance_uuid) + if not instance: + instance = self.db.instance_get_by_uuid(context, instance_uuid) LOG.debug(_('Reset network'), context=context, instance=instance) self.driver.reset_network(instance) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index d79cb0bba..f10efc19a 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -98,6 +98,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): remove_volume_connection() 1.27 - Remove instance_uuid, add instance argument to rescue_instance() + 1.28 - Remove instance_uuid, add instance argument to reset_network() ''' BASE_RPC_API_VERSION = '1.0' @@ -354,9 +355,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): version='1.27') def reset_network(self, ctxt, instance): + instance_p = jsonutils.to_primitive(instance) self.cast(ctxt, self.make_msg('reset_network', - instance_uuid=instance['uuid']), - topic=_compute_topic(self.topic, ctxt, None, instance)) + instance=instance_p), + topic=_compute_topic(self.topic, ctxt, None, instance), + version='1.28') def resize_instance(self, ctxt, instance, migration_id, image): topic = _compute_topic(self.topic, ctxt, None, instance) |
