def _translate_volume_summary_view(context, vol, image_id=None):
 d = {}
 d['id'] = vol['id']
 d['status'] = vol['status']
 d['size'] = vol['size']
 d['availability_zone'] = vol['availability_zone']
 d['created_at'] = vol['created_at']
 d['attachments'] = []
 if (vol['attach_status'] == 'attached'):
  attachment = _translate_attachment_detail_view(context, vol)
  d['attachments'].append(attachment)
 d['display_name'] = vol['display_name']
 d['display_description'] = vol['display_description']
 if (vol['volume_type_id'] and vol.get('volume_type')):
  d['volume_type'] = vol['volume_type']['name']
 else:
  d['volume_type'] = str(vol['volume_type_id'])
 d['snapshot_id'] = vol['snapshot_id']
 d['source_volid'] = vol['source_volid']
 if image_id:
  d['image_id'] = image_id
 LOG.audit(_('vol=%s'), vol, context=context)
 if vol.get('volume_metadata'):
  metadata = vol.get('volume_metadata')
  d['metadata'] = dict(((item['key'], item['value']) for item in metadata))
 elif (vol.get('metadata') and isinstance(vol.get('metadata'), dict)):
  d['metadata'] = vol['metadata']
 else:
  d['metadata'] = {}
 if vol.get('volume_glance_metadata'):
  d['bootable'] = 'true'
 else:
  d['bootable'] = 'false'
 return d

def _translate_volume_summary_view ( context , vol , image_id = None ) : d = { } d [ 'id' ] = vol [ 'id' ] d [ 'status' ] = vol [ 'status' ] d [ 'size' ] = vol [ 'size' ] d [ 'availability_zone' ] = vol [ 'availability_zone' ] d [ 'created_at' ] = vol [ 'created_at' ] d [ 'attachments' ] = [ ] if ( vol [ 'attach_status' ] == 'attached' ) : attachment = _translate_attachment_detail_view ( context , vol ) d [ 'attachments' ] . append ( attachment ) d [ 'display_name' ] = vol [ 'display_name' ] d [ 'display_description' ] = vol [ 'display_description' ] if ( vol [ 'volume_type_id' ] and vol . get ( 'volume_type' ) ) : d [ 'volume_type' ] = vol [ 'volume_type' ] [ 'name' ] else : d [ 'volume_type' ] = str ( vol [ 'volume_type_id' ] ) d [ 'snapshot_id' ] = vol [ 'snapshot_id' ] d [ 'source_volid' ] = vol [ 'source_volid' ] if image_id : d [ 'image_id' ] = image_id LOG . audit ( _ ( 'vol=%s' ) , vol , context = context ) if vol . get ( 'volume_metadata' ) : metadata = vol . get ( 'volume_metadata' ) d [ 'metadata' ] = dict ( ( ( item [ 'key' ] , item [ 'value' ] ) for item in metadata ) ) elif ( vol . get ( 'metadata' ) and isinstance ( vol . get ( 'metadata' ) , dict ) ) : d [ 'metadata' ] = vol [ 'metadata' ] else : d [ 'metadata' ] = { } if vol . get ( 'volume_glance_metadata' ) : d [ 'bootable' ] = 'true' else : d [ 'bootable' ] = 'false' return d
maps keys for volumes summary view .