From 91cfa62b4a09cafa8af0772c68d36de9216dc440 Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Fri, 2 Dec 2011 11:36:38 -0500 Subject: EC2 rescue/unrescue is broken, bug 899225 Change-Id: I5a0b9c08a43e8c606d1c885cf7f47382fa4664a8 --- nova/tests/api/ec2/test_cloud.py | 29 +++++++++++++++++++++++++++++ nova/tests/test_virt_drivers.py | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index 47100b7be..c206f070f 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -1376,6 +1376,35 @@ class CloudTestCase(test.TestCase): else: self.compute = self.start_service('compute') + def test_rescue_instances(self): + kwargs = {'image_id': 'ami-1', + 'instance_type': FLAGS.default_instance_type, + 'max_count': 1, } + instance_id = self._run_instance(**kwargs) + + result = self.cloud.stop_instances(self.context, [instance_id]) + self.assertTrue(result) + + result = self.cloud.rescue_instance(self.context, instance_id) + self.assertTrue(result) + + result = self.cloud.terminate_instances(self.context, [instance_id]) + self.assertTrue(result) + self._restart_compute_service() + + def test_unrescue_instances(self): + kwargs = {'image_id': 'ami-1', + 'instance_type': FLAGS.default_instance_type, + 'max_count': 1, } + instance_id = self._run_instance(**kwargs) + + result = self.cloud.unrescue_instance(self.context, instance_id) + self.assertTrue(result) + + result = self.cloud.terminate_instances(self.context, [instance_id]) + self.assertTrue(result) + self._restart_compute_service() + def test_stop_start_instance(self): """Makes sure stop/start instance works""" # enforce periodic tasks run in short time to avoid wait for 60s. diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py index 137d6c9ca..8b4fa177f 100644 --- a/nova/tests/test_virt_drivers.py +++ b/nova/tests/test_virt_drivers.py @@ -145,7 +145,7 @@ class _VirtDriverTestCase(test.TestCase): @catch_notimplementederror def test_rescue(self): instance_ref, network_info = self._get_running_instance() - self.connection.rescue(self.ctxt, instance_ref, network_info) + self.connection.rescue(self.ctxt, instance_ref, network_info, None) @catch_notimplementederror def test_unrescue_unrescued_instance(self): @@ -155,7 +155,7 @@ class _VirtDriverTestCase(test.TestCase): @catch_notimplementederror def test_unrescue_rescued_instance(self): instance_ref, network_info = self._get_running_instance() - self.connection.rescue(self.ctxt, instance_ref, network_info) + self.connection.rescue(self.ctxt, instance_ref, network_info, None) self.connection.unrescue(instance_ref, network_info) @catch_notimplementederror -- cgit