diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-27 12:21:08 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-30 20:18:38 -0400 |
| commit | 73af6fa9722b720923002f62e115d84b74c9fe33 (patch) | |
| tree | 6707baabf79a2c5f5fb980ce84c47db52e44f65e /nova/compute | |
| parent | 100528f3a0df724c5a9611f0e7a0cce41ca5e12e (diff) | |
Send a full instance in remove_volume_connection.
Change the remove_volume_connection method of the compute
rpc API to take a full instance over rpc instead of just
the instance ID. This cuts down on database access needed
by nova-compute.
Part of blueprint no-db-messaging.
Change-Id: I1bd47b161acd7b6dfb03adb77d00a861f754e188
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 14 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 688b2317c..e23db6812 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.25' + RPC_API_VERSION = '1.26' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -2047,19 +2047,21 @@ class ComputeManager(manager.SchedulerDependentManager): context, instance_uuid, volume_id) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - def remove_volume_connection(self, context, instance_id, volume_id): + def remove_volume_connection(self, context, volume_id, instance=None, + instance_id=None): """Remove a volume connection using the volume api""" # NOTE(vish): We don't want to actually mark the volume # detached, or delete the bdm, just remove the # connection from this host. try: - instance_ref = self.db.instance_get(context, instance_id) + if not instance: + instance = self.db.instance_get(context, instance_id) bdm = self._get_instance_volume_bdm(context, - instance_ref['uuid'], + instance['uuid'], volume_id) - self._detach_volume(context, instance_ref, bdm) + self._detach_volume(context, instance, bdm) volume = self.volume_api.get(context, volume_id) - connector = self.driver.get_volume_connector(instance_ref) + connector = self.driver.get_volume_connector(instance) self.volume_api.terminate_connection(context, volume, connector) except exception.NotFound: pass diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 70f3da64c..d7cc3e2b9 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -94,6 +94,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): rebuild_instance() 1.25 - Remove instance_uuid, add instance argument to remove_fixed_ip_from_instance() + 1.26 - Remove instance_id, add instance argument to + remove_volume_connection() ''' BASE_RPC_API_VERSION = '1.0' @@ -335,9 +337,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): version='1.25') def remove_volume_connection(self, ctxt, instance, volume_id, host): + instance_p = jsonutils.to_primitive(instance) return self.call(ctxt, self.make_msg('remove_volume_connection', - instance_id=instance['id'], volume_id=volume_id), - topic=_compute_topic(self.topic, ctxt, host, None)) + instance=instance_p, volume_id=volume_id), + topic=_compute_topic(self.topic, ctxt, host, None), + version='1.26') def rescue_instance(self, ctxt, instance, rescue_password): self.cast(ctxt, self.make_msg('rescue_instance', |
