def _get_alias_from_config():
 jaliases = CONF.pci.alias
 aliases = {}
 try:
  for jsonspecs in jaliases:
   spec = jsonutils.loads(jsonspecs)
   jsonschema.validate(spec, _ALIAS_SCHEMA)
   name = spec.pop('name').strip()
   dev_type = spec.pop('device_type', None)
   if dev_type:
    spec['dev_type'] = dev_type
   if (name not in aliases):
    aliases[name] = [spec]
   elif (aliases[name][0]['dev_type'] == spec['dev_type']):
    aliases[name].append(spec)
   else:
    reason = (_("Device type mismatch for alias '%s'") % name)
    raise exception.PciInvalidAlias(reason=reason)
 except exception.PciInvalidAlias:
  raise
 except Exception as e:
  raise exception.PciInvalidAlias(reason=six.text_type(e))
 return aliases

def _get_alias_from_config ( ) : jaliases = CONF . pci . alias aliases = { } try : for jsonspecs in jaliases : spec = jsonutils . loads ( jsonspecs ) jsonschema . validate ( spec , _ALIAS_SCHEMA ) name = spec . pop ( 'name' ) . strip ( ) dev_type = spec . pop ( 'device_type' , None ) if dev_type : spec [ 'dev_type' ] = dev_type if ( name not in aliases ) : aliases [ name ] = [ spec ] elif ( aliases [ name ] [ 0 ] [ 'dev_type' ] == spec [ 'dev_type' ] ) : aliases [ name ] . append ( spec ) else : reason = ( _ ( "Device type mismatch for alias '%s'" ) % name ) raise exception . PciInvalidAlias ( reason = reason ) except exception . PciInvalidAlias : raise except Exception as e : raise exception . PciInvalidAlias ( reason = six . text_type ( e ) ) return aliases
parse and validate pci aliases from the nova config .