summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-09-05 14:07:16 -0400
committerDan Prince <dprince@redhat.com>2012-09-06 17:08:50 -0400
commita766d817218edcbb35c477382d5839f53c1f9570 (patch)
tree79994e374e5850f75bbcbdc130490b91d04837e3 /nova/api
parent20ae7ee86ac32005012592936b763b812340cebd (diff)
Fix EC2 cinder volume creation as an admin user.
Updates the EC2 API _format_volume function so that it only tries to add project_id and host to responses if those keys are present. This resolves a KeyError that would occur when using Cinder because volumes from it don't contain this information. Fixes LP Bug #1046464. Change-Id: I56b977cfd1ae482f2559a3f1fda8d1543d3ea227
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 45c22b45d..14aa39438 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -722,10 +722,11 @@ class CloudController(object):
v['availabilityZone'] = volume['availability_zone']
v['createTime'] = volume['created_at']
if context.is_admin:
+ # NOTE(dprince): project_id and host_id are unset w/ Cinder
v['status'] = '%s (%s, %s, %s, %s)' % (
volume['status'],
- volume['project_id'],
- volume['host'],
+ volume.get('project_id', ''),
+ volume.get('host', ''),
instance_data,
volume['mountpoint'])
if volume['attach_status'] == 'attached':