diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-30 11:43:48 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-30 20:18:38 -0400 |
| commit | 3359e31b204c9a3ac0f4d8bc400a3d7c4c3c081f (patch) | |
| tree | 7f4326f283ba8b83d5296f01e2da2051eca1d236 /nova/compute | |
| parent | 564def16ba2b684c0fbdaef1861b5fddd9ed4b5c (diff) | |
Send a full instance in revert_resize.
Change the revert_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: I55bdc63149c0385fbf151f4f86f40e6c7635cf63
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 ff6723f9f..f1de42d61 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.30' + RPC_API_VERSION = '1.31' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1413,7 +1413,8 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock @wrap_instance_fault - def revert_resize(self, context, instance_uuid, migration_id): + def revert_resize(self, context, migration_id, instance=None, + instance_uuid=None): """Destroys the new instance on the destination machine. Reverts the model changes, and powers on the old instance on the @@ -1421,16 +1422,17 @@ class ComputeManager(manager.SchedulerDependentManager): """ 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) # NOTE(tr3buchet): tear down networks on destination host - self.network_api.setup_networks_on_host(context, instance_ref, - teardown=True) + self.network_api.setup_networks_on_host(context, instance, + teardown=True) - network_info = self._get_instance_nw_info(context, instance_ref) - self.driver.destroy(instance_ref, self._legacy_nw_info(network_info)) - self.compute_rpcapi.finish_revert_resize(context, instance_ref, + network_info = self._get_instance_nw_info(context, instance) + self.driver.destroy(instance, self._legacy_nw_info(network_info)) + self.compute_rpcapi.finish_revert_resize(context, instance, migration_ref['id'], migration_ref['source_compute']) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index b09211d1a..107bf4d8d 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -101,6 +101,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.28 - Remove instance_uuid, add instance argument to reset_network() 1.29 - Remove instance_uuid, add instance argument to resize_instance() 1.30 - Remove instance_uuid, add instance argument to resume_instance() + 1.31 - Remove instance_uuid, add instance argument to revert_resize() ''' BASE_RPC_API_VERSION = '1.0' @@ -378,9 +379,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): version='1.30') def revert_resize(self, ctxt, instance, migration_id, host): + instance_p = jsonutils.to_primitive(instance) self.cast(ctxt, self.make_msg('revert_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.31') def rollback_live_migration_at_destination(self, ctxt, instance, host): self.cast(ctxt, self.make_msg('rollback_live_migration_at_destination', |
