summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-07-26 16:45:22 -0400
committerRussell Bryant <rbryant@redhat.com>2012-07-26 18:46:32 -0400
commitd5c3271b1159ea3dfce3c0bf56b75006784ee439 (patch)
treef1a07d430f26990985c7b4f94e213751a6ac1f04 /nova/compute
parent2203249e190535aff7799a689effff77743fba61 (diff)
Send a full instance via rpc for post_live_migration_at_destination.
Change the post_live_migration_at_destination 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. The method got moved in rpcapi.py, but that was just to restore alphabetical order. Part of blueprint no-db-messaging. Change-Id: Ib36cb065f838f644e97b6e82b39409737df15558
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py24
-rw-r--r--nova/compute/rpcapi.py18
2 files changed, 23 insertions, 19 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index ae47b6caa..7e555b010 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -298,7 +298,7 @@ def _get_additional_capabilities():
class ComputeManager(manager.SchedulerDependentManager):
"""Manages the running instances from creation to destruction."""
- RPC_API_VERSION = '1.19'
+ RPC_API_VERSION = '1.20'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -2338,7 +2338,8 @@ class ComputeManager(manager.SchedulerDependentManager):
"This error can be safely ignored."),
instance=instance_ref)
- def post_live_migration_at_destination(self, context, instance_id,
+ def post_live_migration_at_destination(self, context, instance=None,
+ instance_id=None,
block_migration=False):
"""Post operations for live migration .
@@ -2347,34 +2348,33 @@ class ComputeManager(manager.SchedulerDependentManager):
:param block_migration: if true, prepare for block migration
"""
- instance_ref = self.db.instance_get(context, instance_id)
+ if not instance:
+ instance = self.db.instance_get(context, instance_id)
LOG.info(_('Post operation of migraton started'),
- instance=instance_ref)
+ instance=instance)
# NOTE(tr3buchet): setup networks on destination host
# this is called a second time because
# multi_host does not create the bridge in
# plug_vifs
- self.network_api.setup_networks_on_host(context, instance_ref,
+ self.network_api.setup_networks_on_host(context, instance,
self.host)
- network_info = self._get_instance_nw_info(context, instance_ref)
- self.driver.post_live_migration_at_destination(context, instance_ref,
+ network_info = self._get_instance_nw_info(context, instance)
+ self.driver.post_live_migration_at_destination(context, instance,
self._legacy_nw_info(network_info),
block_migration)
# Restore instance state
- current_power_state = self._get_power_state(context, instance_ref)
+ current_power_state = self._get_power_state(context, instance)
self._instance_update(context,
- instance_ref['uuid'],
+ instance['uuid'],
host=self.host,
power_state=current_power_state,
vm_state=vm_states.ACTIVE,
task_state=None)
# NOTE(vish): this is necessary to update dhcp
- self.network_api.setup_networks_on_host(context,
- instance_ref,
- self.host)
+ self.network_api.setup_networks_on_host(context, instance, self.host)
def rollback_live_migration(self, context, instance_ref,
dest, block_migration):
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 4b012de78..7243e37c5 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -82,6 +82,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
1.18 - Remove instance_uuid, add instance argument to inject_file()
1.19 - Remove instance_uuid, add instance argument to
inject_network_info()
+ 1.20 - Remove instance_id, add instance argument to
+ post_live_migration_at_destination()
'''
BASE_RPC_API_VERSION = '1.0'
@@ -232,13 +234,6 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
topic=_compute_topic(self.topic, ctxt, None, instance),
version='1.19')
- def post_live_migration_at_destination(self, ctxt, instance,
- block_migration, host):
- return self.call(ctxt,
- self.make_msg('post_live_migration_at_destination',
- instance_id=instance['id'], block_migration=block_migration),
- _compute_topic(self.topic, ctxt, host, None))
-
def pause_instance(self, ctxt, instance):
instance_p = jsonutils.to_primitive(instance)
self.cast(ctxt, self.make_msg('pause_instance',
@@ -246,6 +241,15 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
topic=_compute_topic(self.topic, ctxt, None, instance),
version='1.5')
+ def post_live_migration_at_destination(self, ctxt, instance,
+ block_migration, host):
+ instance_p = jsonutils.to_primitive(instance)
+ return self.call(ctxt,
+ self.make_msg('post_live_migration_at_destination',
+ instance=instance_p, block_migration=block_migration),
+ _compute_topic(self.topic, ctxt, host, None),
+ version='1.20')
+
def power_off_instance(self, ctxt, instance):
self.cast(ctxt, self.make_msg('power_off_instance',
instance_uuid=instance['uuid']),