From fd6fa90d5f293be7fac4f1e612958cc8e55ee796 Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Mon, 22 Apr 2013 10:51:00 +0930 Subject: ec2 CreateVolumes/DescribeVolumes status mapping 'attaching' and 'detaching' are not valid ec2 API volume status values. Instead map them both to 'in-use'. Note this will not pass the devstack exercises until https://review.openstack.org/#/c/27244/ goes through Fixes bug #1074901 Change-Id: Id3dfd525d24d622aab5e350e42713fdb7671b31e --- nova/api/ec2/cloud.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 96206da58..4b779e26f 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -788,6 +788,10 @@ class CloudController(object): return {'volumeSet': volumes} def _format_volume(self, context, volume): + valid_ec2_api_volume_status_map = { + 'attaching': 'in-use', + 'detaching': 'in-use'} + instance_ec2_id = None instance_data = None @@ -801,7 +805,8 @@ class CloudController(object): instance['host']) v = {} v['volumeId'] = ec2utils.id_to_ec2_vol_id(volume['id']) - v['status'] = volume['status'] + v['status'] = valid_ec2_api_volume_status_map.get(volume['status'], + volume['status']) v['size'] = volume['size'] v['availabilityZone'] = volume['availability_zone'] v['createTime'] = volume['created_at'] -- cgit