diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-01-16 13:41:48 -0800 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2012-01-16 13:48:41 -0800 |
| commit | c1cf917bceeabdddf6f14bc0e51663e1df382677 (patch) | |
| tree | 37d055d53dcddc54e49100a0cb3c12dafce577e3 /nova/api | |
| parent | f673db9b2c21d4709db467a633f1279796b6d085 (diff) | |
| download | nova-c1cf917bceeabdddf6f14bc0e51663e1df382677.tar.gz nova-c1cf917bceeabdddf6f14bc0e51663e1df382677.tar.xz nova-c1cf917bceeabdddf6f14bc0e51663e1df382677.zip | |
Add tests for volume list and detail through new volume api, and fix error that the tests caught
Change-Id: I6c706e4681cf079caab614b0870315b275339028
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/volume/volumes.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nova/api/openstack/volume/volumes.py b/nova/api/openstack/volume/volumes.py index 6783244d6..b37a56374 100644 --- a/nova/api/openstack/volume/volumes.py +++ b/nova/api/openstack/volume/volumes.py @@ -34,6 +34,34 @@ LOG = logging.getLogger("nova.api.openstack.volume.volumes") FLAGS = flags.FLAGS +def _translate_attachment_detail_view(_context, vol): + """Maps keys for attachment details view.""" + + d = _translate_attachment_summary_view(_context, vol) + + # No additional data / lookups at the moment + + return d + + +def _translate_attachment_summary_view(_context, vol): + """Maps keys for attachment summary view.""" + d = {} + + volume_id = vol['id'] + + # NOTE(justinsb): We use the volume id as the id of the attachment object + d['id'] = volume_id + + d['volumeId'] = volume_id + if vol.get('instance'): + d['serverId'] = vol['instance']['uuid'] + if vol.get('mountpoint'): + d['device'] = vol['mountpoint'] + + return d + + def _translate_volume_detail_view(context, vol): """Maps keys for volumes details view.""" |
