summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorBrian Waldon <bcwaldon@gmail.com>2012-02-28 17:11:05 -0800
committerBrian Waldon <bcwaldon@gmail.com>2012-02-28 21:32:09 -0800
commit36100f6f99b317ef9f10f101f7cecfb1639255a8 (patch)
treeb95bf140d1c16623cf9d822a1f71ca0a0c7a81dd /nova/api
parent9a6dfec8276520a200cd7dfa4e7e2997ffeb45d6 (diff)
Return empty list when volume not attached
* The api used to return a list of a single empty dict * Fixes bug 942990 Change-Id: I9926515acfcedf711e81615aa13cec0bbf968086
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/volume/volumes.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/api/openstack/volume/volumes.py b/nova/api/openstack/volume/volumes.py
index 45ad297a4..edad3286a 100644
--- a/nova/api/openstack/volume/volumes.py
+++ b/nova/api/openstack/volume/volumes.py
@@ -84,10 +84,10 @@ def _translate_volume_summary_view(context, vol):
d['availabilityZone'] = vol['availability_zone']
d['createdAt'] = vol['created_at']
+ d['attachments'] = []
if vol['attach_status'] == 'attached':
- d['attachments'] = [_translate_attachment_detail_view(context, vol)]
- else:
- d['attachments'] = [{}]
+ attachment = _translate_attachment_detail_view(context, vol)
+ d['attachments'].append(attachment)
d['displayName'] = vol['display_name']
d['displayDescription'] = vol['display_description']