def get_valid_qos_policy_group_info(volume, extra_specs=None):
 info = dict(legacy=None, spec=None)
 try:
  volume_type = get_volume_type_from_volume(volume)
 except KeyError:
  LOG.exception(_LE('Cannot get QoS spec for volume %s.'), volume['id'])
  return info
 if (volume_type is None):
  return info
 if (extra_specs is None):
  extra_specs = volume_type.get('extra_specs', {})
 info['legacy'] = get_legacy_qos_policy(extra_specs)
 info['spec'] = get_valid_backend_qos_spec_from_volume_type(volume, volume_type)
 msg = 'QoS policy group info for volume %(vol)s: %(info)s'
 LOG.debug(msg, {'vol': volume['name'], 'info': info})
 check_for_invalid_qos_spec_combination(info, volume_type)
 return info

def get_valid_qos_policy_group_info ( volume , extra_specs = None ) : info = dict ( legacy = None , spec = None ) try : volume_type = get_volume_type_from_volume ( volume ) except KeyError : LOG . exception ( _LE ( 'Cannot get QoS spec for volume %s.' ) , volume [ 'id' ] ) return info if ( volume_type is None ) : return info if ( extra_specs is None ) : extra_specs = volume_type . get ( 'extra_specs' , { } ) info [ 'legacy' ] = get_legacy_qos_policy ( extra_specs ) info [ 'spec' ] = get_valid_backend_qos_spec_from_volume_type ( volume , volume_type ) msg = 'QoS policy group info for volume %(vol)s: %(info)s' LOG . debug ( msg , { 'vol' : volume [ 'name' ] , 'info' : info } ) check_for_invalid_qos_spec_combination ( info , volume_type ) return info
given a volume .