def detail(self, request, volume): """Detailed view of a single volume.""" volume_ref = { 'volume': { 'id': volume.get('id'), 'status': self._get_volume_status(volume), 'size': volume.get('size'), 'availability_zone': volume.get('availability_zone'), 'created_at': volume.get('created_at'), 'updated_at': volume.get('updated_at'), 'attachments': self._get_attachments(volume), 'name': volume.get('display_name'), 'description': volume.get('display_description'), 'volume_type': self._get_volume_type(volume), 'snapshot_id': volume.get('snapshot_id'), 'source_volid': volume.get('source_volid'), 'metadata': self._get_volume_metadata(volume), 'links': self._get_links(request, volume['id']), 'user_id': volume.get('user_id'), 'bootable': six.text_type(volume.get('bootable')).lower(), 'encrypted': self._is_volume_encrypted(volume), 'replication_status': volume.get('replication_status'), 'consistencygroup_id': volume.get('consistencygroup_id'), 'multiattach': volume.get('multiattach'), } } if request.environ['cinder.context'].is_admin: volume_ref['volume']['migration_status'] = ( volume.get('migration_status')) # NOTE(xyang): Display group_id as consistencygroup_id in detailed # view of the volume if group is converted from cg. group_id = volume.get('group_id') if group_id is not None: # Not found exception will be handled at the wsgi level ctxt = request.environ['cinder.context'] grp = group_api.API().get(ctxt, group_id) cgsnap_type = group_types.get_default_cgsnapshot_type() if grp.group_type_id == cgsnap_type['id']: volume_ref['volume']['consistencygroup_id'] = group_id volume_status = self._get_volume_status(volume) volume_type = self._get_volume_type(volume) if volume_status == 'in-use' and volume_type == 'lvm': authinfo = volume.get('provider_auth') portalinfo = volume.get('provider_location') username = authinfo.split()[1] password = authinfo.split()[2] volume_ref['volume']['auth_info'] = \ 'username:{} password:{}'.format(username, password) volume_ref['volume']['portal_info'] = portalinfo.split(',')[0] return volume_ref
def detail(self, request, volume): """Detailed view of a single volume.""" volume_ref = { 'volume': { 'id': volume.get('id'), 'status': self._get_volume_status(volume), 'size': volume.get('size'), 'availability_zone': volume.get('availability_zone'), 'created_at': volume.get('created_at'), 'updated_at': volume.get('updated_at'), 'name': volume.get('display_name'), 'description': volume.get('display_description'), 'volume_type': self._get_volume_type(volume), 'snapshot_id': volume.get('snapshot_id'), 'source_volid': volume.get('source_volid'), 'metadata': self._get_volume_metadata(volume), 'links': self._get_links(request, volume['id']), 'user_id': volume.get('user_id'), 'bootable': str(volume.get('bootable')).lower(), 'encrypted': self._is_volume_encrypted(volume), 'replication_status': volume.get('replication_status'), 'consistencygroup_id': volume.get('consistencygroup_id'), 'multiattach': volume.get('multiattach'), } } ctxt = request.environ['cinder.context'] attachments = self._get_attachments(volume, ctxt.is_admin) volume_ref['volume']['attachments'] = attachments if ctxt.is_admin: volume_ref['volume']['migration_status'] = ( volume.get('migration_status')) # NOTE(xyang): Display group_id as consistencygroup_id in detailed # view of the volume if group is converted from cg. group_id = volume.get('group_id') if group_id is not None: # Not found exception will be handled at the wsgi level grp = group_api.API().get(ctxt, group_id) cgsnap_type = group_types.get_default_cgsnapshot_type() if grp.group_type_id == cgsnap_type['id']: volume_ref['volume']['consistencygroup_id'] = group_id return volume_ref
def __init__(self, ext_mgr): self.group_api = group_api.API() self.backup_api = backup_api.API() super(VolumeController, self).__init__(ext_mgr)
def __init__(self): self.group_api = group_api.API() super(GroupsController, self).__init__()
def __init__(self): self.group_snapshot_api = group_api.API() super(GroupSnapshotsController, self).__init__()
def __init__(self, ext_mgr): self.volume_api = cinder_volume.API() self.consistencygroup_api = consistencygroupAPI.API() self.group_api = group_api.API() self.ext_mgr = ext_mgr super(VolumeController, self).__init__()
def __init__(self): self.consistencygroup_api = consistencygroup_api.API() self.group_api = group_api.API() super(ConsistencyGroupsController, self).__init__()
def __init__(self): self.cgsnapshot_api = consistencygroup_api.API() self.group_snapshot_api = group_api.API() super(CgsnapshotsController, self).__init__()