def volume_get(request, volume_id): client = _cinderclient_with_generic_groups(request) volume_data = client.volumes.get(volume_id) for attachment in volume_data.attachments: if "server_id" in attachment: instance = _nova.server_get(request, attachment['server_id']) attachment['instance_name'] = instance.name else: # Nova volume can occasionally send back error'd attachments # the lack a server_id property; to work around that we'll # give the attached instance a generic name. attachment['instance_name'] = _("Unknown instance") volume_data.transfer = None if volume_data.status == 'awaiting-transfer': for transfer in transfer_list(request): if transfer.volume_id == volume_id: volume_data.transfer = transfer break return Volume(volume_data)