diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-01-17 00:51:37 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-01-17 00:51:37 +0000 |
| commit | 3972390d286ba487a53a27fa59a6cc1b0e2573ba (patch) | |
| tree | d228b357d89b27a353fc324cbbbfe2df700ef96f /nova/api | |
| parent | f2fc7dd9b2dbf9259c232f9561804dc6c0cff0bd (diff) | |
| parent | c1cf917bceeabdddf6f14bc0e51663e1df382677 (diff) | |
Merge "Add tests for volume list and detail through new volume api, and fix error that the tests caught"
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.""" |
