diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-25 16:48:55 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-25 20:44:20 -0400 |
| commit | bfc335f0f43b868f75fcd9d1e148bb6fca397b83 (patch) | |
| tree | 687232cf3550e6cf6f5ace1d1cc3a5ce76d5b772 /nova/compute | |
| parent | 2fed9559934fb44eed394f12aba8c8ff0dcdb60c (diff) | |
Send a full instance via rpc for confirm_resize.
Change the confirm_resize 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: I58313564b240c6b55de1849efc2d5d9031a1c97c
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 20 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 7 |
2 files changed, 16 insertions, 11 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 1a423a3c8..bb1e754d9 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -297,7 +297,7 @@ def _get_additional_capabilities(): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '1.11' + RPC_API_VERSION = '1.12' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1399,25 +1399,27 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock @wrap_instance_fault - def confirm_resize(self, context, instance_uuid, migration_id): + def confirm_resize(self, context, migration_id, instance_uuid=None, + instance=None): """Destroys the source instance.""" migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get_by_uuid(context, - migration_ref.instance_uuid) + if not instance: + instance = self.db.instance_get_by_uuid(context, + migration_ref.instance_uuid) - self._notify_about_instance_usage(context, instance_ref, + self._notify_about_instance_usage(context, instance, "resize.confirm.start") # NOTE(tr3buchet): tear down networks on source host - self.network_api.setup_networks_on_host(context, instance_ref, + self.network_api.setup_networks_on_host(context, instance, migration_ref['source_compute'], teardown=True) - network_info = self._get_instance_nw_info(context, instance_ref) - self.driver.confirm_migration(migration_ref, instance_ref, + network_info = self._get_instance_nw_info(context, instance) + self.driver.confirm_migration(migration_ref, instance, self._legacy_nw_info(network_info)) self._notify_about_instance_usage( - context, instance_ref, "resize.confirm.end", + context, instance, "resize.confirm.end", network_info=network_info) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 19c72bd08..aabafb10b 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -72,6 +72,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): check_can_live_migrate_destination() 1.11 - Remove instance_id, add instance argument to check_can_live_migrate_source() + 1.12 - Remove instance_uuid, add instance argument to confirm_resize() ''' BASE_RPC_API_VERSION = '1.0' @@ -130,9 +131,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): def confirm_resize(self, ctxt, instance, migration_id, host, cast=True): rpc_method = self.cast if cast else self.call + instance_p = jsonutils.to_primitive(instance) return rpc_method(ctxt, self.make_msg('confirm_resize', - instance_uuid=instance['uuid'], migration_id=migration_id), - topic=_compute_topic(self.topic, ctxt, host, instance)) + instance=instance_p, migration_id=migration_id), + topic=_compute_topic(self.topic, ctxt, host, instance), + version='1.12') def detach_volume(self, ctxt, instance, volume_id): self.cast(ctxt, self.make_msg('detach_volume', |
