summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-27 15:02:34 +0000
committerGerrit Code Review <review@openstack.org>2012-07-27 15:02:34 +0000
commit218ecc090940c599dd5246eb078cbcf1868194fb (patch)
tree3271ffc4f1da83a8a3493b9b13f22f0c2df4019a /nova/compute
parentef5d5951d891171d385eefee7562383ef59cb6d3 (diff)
parent01985dd44d1b29c7ad7cb0932a1d30f7b6fe1911 (diff)
Merge "Send a full instance in pre_live_migration."
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/manager.py25
-rw-r--r--nova/compute/rpcapi.py8
2 files changed, 18 insertions, 15 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index ef1bdbcc6..ff0fafcce 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -295,7 +295,7 @@ def _get_additional_capabilities():
class ComputeManager(manager.SchedulerDependentManager):
"""Manages the running instances from creation to destruction."""
- RPC_API_VERSION = '1.22'
+ RPC_API_VERSION = '1.23'
def __init__(self, compute_driver=None, *args, **kwargs):
"""Load configuration options and connect to the hypervisor."""
@@ -2159,7 +2159,7 @@ class ComputeManager(manager.SchedulerDependentManager):
self.driver.check_can_live_migrate_source(ctxt, instance,
dest_check_data)
- def pre_live_migration(self, context, instance_id,
+ def pre_live_migration(self, context, instance=None, instance_id=None,
block_migration=False, disk=None):
"""Preparations for live migration at dest host.
@@ -2168,16 +2168,17 @@ class ComputeManager(manager.SchedulerDependentManager):
:param block_migration: if true, prepare for block migration
"""
- # Getting instance info
- instance_ref = self.db.instance_get(context, instance_id)
+ if not instance:
+ # Getting instance info
+ instance = self.db.instance_get(context, instance_id)
# If any volume is mounted, prepare here.
block_device_info = self._get_instance_volume_block_device_info(
- context, instance_ref['uuid'])
+ context, instance['uuid'])
if not block_device_info['block_device_mapping']:
- LOG.info(_('Instance has no volume.'), instance=instance_ref)
+ LOG.info(_('Instance has no volume.'), instance=instance)
- network_info = self._get_instance_nw_info(context, instance_ref)
+ network_info = self._get_instance_nw_info(context, instance)
# TODO(tr3buchet): figure out how on the earth this is necessary
fixed_ips = network_info.fixed_ips()
@@ -2185,12 +2186,12 @@ class ComputeManager(manager.SchedulerDependentManager):
raise exception.FixedIpNotFoundForInstance(
instance_id=instance_id)
- self.driver.pre_live_migration(context, instance_ref,
+ self.driver.pre_live_migration(context, instance,
block_device_info,
self._legacy_nw_info(network_info))
# NOTE(tr3buchet): setup networks on destination host
- self.network_api.setup_networks_on_host(context, instance_ref,
+ self.network_api.setup_networks_on_host(context, instance,
self.host)
# Creating filters to hypervisors and firewalls.
@@ -2199,14 +2200,12 @@ class ComputeManager(manager.SchedulerDependentManager):
# This nwfilter is necessary on the destination host.
# In addition, this method is creating filtering rule
# onto destination host.
- self.driver.ensure_filtering_rules_for_instance(instance_ref,
+ self.driver.ensure_filtering_rules_for_instance(instance,
self._legacy_nw_info(network_info))
# Preparation for block migration
if block_migration:
- self.driver.pre_block_migration(context,
- instance_ref,
- disk)
+ self.driver.pre_block_migration(context, instance, disk)
def live_migration(self, context, instance_id,
dest, block_migration=False):
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index a99c8f492..5def90cd2 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -88,6 +88,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
power_off_instance() and stop_instance()
1.22 - Remove instance_uuid, add instance argument to
power_on_instance() and start_instance()
+ 1.23 - Remove instance_id, add instance argument to
+ pre_live_migration()
'''
BASE_RPC_API_VERSION = '1.0'
@@ -270,9 +272,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy):
def pre_live_migration(self, ctxt, instance, block_migration, disk,
host):
+ instance_p = jsonutils.to_primitive(instance)
return self.call(ctxt, self.make_msg('pre_live_migration',
- instance_id=instance['id'], block_migration=block_migration,
- disk=disk), _compute_topic(self.topic, ctxt, host, None))
+ instance=instance_p, block_migration=block_migration,
+ disk=disk), _compute_topic(self.topic, ctxt, host, None),
+ version='1.23')
def reboot_instance(self, ctxt, instance, reboot_type):
instance_p = jsonutils.to_primitive(instance)