diff options
| author | Thorsten Tarrach <thorsten@atomia.com> | 2012-08-08 15:13:21 +0200 |
|---|---|---|
| committer | Thorsten Tarrach <thorsten@atomia.com> | 2012-08-09 16:03:41 +0200 |
| commit | 0fa3f0e6da4e8f1d5d09e6797bb5eae806ece400 (patch) | |
| tree | 4051492c6a8b478147954a8d49d124e79a80b4c1 | |
| parent | a418654b070c63c4bed5e3e5523fb947934626f9 (diff) | |
| download | nova-0fa3f0e6da4e8f1d5d09e6797bb5eae806ece400.tar.gz nova-0fa3f0e6da4e8f1d5d09e6797bb5eae806ece400.tar.xz nova-0fa3f0e6da4e8f1d5d09e6797bb5eae806ece400.zip | |
Make TerminateInstances compatible with EC2 api
fixes bug 1034377
Currently the XML response for TerminateInstances differs
from the EC2 api specifications and causes the .net EC2 api
from Amazon to crash.
Change-Id: I14172318ed4dc2af16c45be376475885f474c545
| -rw-r--r-- | nova/api/ec2/cloud.py | 4 | ||||
| -rw-r--r-- | nova/tests/api/ec2/test_cloud.py | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 5e85cd88a..5b7bdf4ea 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -921,10 +921,10 @@ class CloudController(object): try: internal_id = ec2utils.ec2_id_to_id(ec2_id) instance = self.compute_api.get(context, internal_id) - i['shutdownState'] = _state_description(instance['vm_state'], + i['currentState'] = _state_description(instance['vm_state'], instance['shutdown_terminate']) except exception.NotFound: - i['shutdownState'] = _state_description(vm_states.DELETED, + i['currentState'] = _state_description(vm_states.DELETED, True) instances_set.append(i) return {'instancesSet': instances_set} diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index ef78c007b..de3077fd7 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -1809,7 +1809,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 80, 'name': 'stopped'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1830,7 +1830,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1849,7 +1849,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 80, 'name': 'stopped'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1870,7 +1870,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1902,7 +1902,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 16, + 'currentState': {'code': 16, 'name': 'running'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1914,7 +1914,7 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) self.assertEqual(result, expected) @@ -1934,12 +1934,12 @@ class CloudTestCase(test.TestCase): {'instanceId': 'i-00000001', 'previousState': {'code': 80, 'name': 'stopped'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}, {'instanceId': 'i-00000002', 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [inst1, inst2]) self.assertEqual(result, expected) @@ -2460,7 +2460,7 @@ class CloudTestCase(test.TestCase): {'instanceId': instance_id, 'previousState': {'code': 16, 'name': 'running'}, - 'shutdownState': {'code': 48, + 'currentState': {'code': 48, 'name': 'terminated'}}]} result = self.cloud.terminate_instances(self.context, [instance_id]) |
