diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-27 14:28:36 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-27 14:28:36 +0000 |
| commit | 44bf63f1c5bc1f5cc41e77b3a413cc7852e4de86 (patch) | |
| tree | 8c2ac4bd09bd6fb2f6df1cf706f84add7697cd63 /nova/compute | |
| parent | c42a1a5e4df0802b5d8e70ed8135ff42e23c5480 (diff) | |
| parent | d5c3271b1159ea3dfce3c0bf56b75006784ee439 (diff) | |
Merge "Send a full instance via rpc for post_live_migration_at_destination."
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 24 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 18 |
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']), |
