summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-05-29 18:28:09 -0400
committerRussell Bryant <rbryant@redhat.com>2012-05-31 15:19:31 -0400
commit3a829e3543b8a346fce95f71cd51f68e7c4aae41 (patch)
treea625abff77559825d5cf8e72b50dffb1e9425cc3 /nova
parent18108a0143df0847fe1a4b105b787ca9ca76f422 (diff)
Add rollback_live_migration_at_destination() to compute rpcapi.
Part of bug 1006467. This patch adds rollback_live_migration_at_destination() to the compute rpcapi. This method is used by the compute manager. Change-Id: Iadbb50fc5cb0f7b5ad483d48666bc81e033ac5f4
Diffstat (limited to 'nova')
-rw-r--r--nova/compute/manager.py6
-rw-r--r--nova/compute/rpcapi.py5
-rw-r--r--nova/tests/compute/test_rpcapi.py19
3 files changed, 24 insertions, 6 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index e0c2eb2da..95c5bd763 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -2214,10 +2214,8 @@ class ComputeManager(manager.SchedulerDependentManager):
# before migration starts, so if any failure occurs,
# any empty images has to be deleted.
if block_migration:
- rpc.cast(context,
- rpc.queue_get_for(context, FLAGS.compute_topic, dest),
- {"method": "rollback_live_migration_at_destination",
- "args": {'instance_id': instance_ref['id']}})
+ self.compute_rpcapi.rollback_live_migration_at_destination(context,
+ instance_ref, dest)
def rollback_live_migration_at_destination(self, context, instance_id):
""" Cleaning up image directory that is created pre_live_migration.
diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py
index 908c40c5e..c08cdfe15 100644
--- a/nova/compute/rpcapi.py
+++ b/nova/compute/rpcapi.py
@@ -244,6 +244,11 @@ class ComputeAPI(nova.rpc.proxy.RpcProxy):
instance_uuid=instance['uuid'], migration_id=migration_id),
topic=self._compute_topic(ctxt, host, instance))
+ def rollback_live_migration_at_destination(self, ctxt, instance, host):
+ self.cast(ctxt, self.make_msg('rollback_live_migration_at_destination',
+ instance_id=instance['id']),
+ topic=self._compute_topic(ctxt, host, None))
+
def set_admin_password(self, ctxt, instance, new_pass):
self.cast(ctxt, self.make_msg('set_admin_password',
instance_uuid=instance['uuid'], new_pass=new_pass),
diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py
index cb50bc39a..95edb3622 100644
--- a/nova/tests/compute/test_rpcapi.py
+++ b/nova/tests/compute/test_rpcapi.py
@@ -31,7 +31,12 @@ FLAGS = flags.FLAGS
class ComputeRpcAPITestCase(test.TestCase):
def setUp(self):
- self.fake_instance = {'uuid': 'fake_uuid', 'host': 'fake_host'}
+ self.fake_instance = {
+ 'uuid': 'fake_uuid',
+ 'host': 'fake_host',
+ 'name': 'fake_name',
+ 'id': 'fake_id',
+ }
super(ComputeRpcAPITestCase, self).setUp()
def tearDown(self):
@@ -41,6 +46,7 @@ class ComputeRpcAPITestCase(test.TestCase):
ctxt = context.RequestContext('fake_user', 'fake_project')
rpcapi = compute_rpcapi.ComputeAPI()
expected_retval = 'foo' if method == 'call' else None
+
expected_msg = rpcapi.make_msg(method, **kwargs)
if 'host_param' in expected_msg['args']:
host_param = expected_msg['args']['host_param']
@@ -51,8 +57,13 @@ class ComputeRpcAPITestCase(test.TestCase):
if 'instance' in expected_msg['args']:
instance = expected_msg['args']['instance']
del expected_msg['args']['instance']
- expected_msg['args']['instance_uuid'] = instance['uuid']
+ if method in ['rollback_live_migration_at_destination']:
+ expected_msg['args']['instance_id'] = instance['id']
+ else:
+ expected_msg['args']['instance_uuid'] = instance['uuid']
+
expected_msg['version'] = rpcapi.RPC_API_VERSION
+
cast_and_call = ['confirm_resize', 'stop_instance']
if rpc_method == 'call' and method in cast_and_call:
kwargs['cast'] = False
@@ -207,6 +218,10 @@ class ComputeRpcAPITestCase(test.TestCase):
self._test_compute_api('revert_resize', 'cast',
instance=self.fake_instance, migration_id='id', host='host')
+ def test_rollback_live_migration_at_destination(self):
+ self._test_compute_api('rollback_live_migration_at_destination',
+ 'cast', instance=self.fake_instance, host='host')
+
def test_set_admin_password(self):
self._test_compute_api('set_admin_password', 'cast',
instance=self.fake_instance, new_pass='pw')