Ejemplo n.º 1
0
 def __init__(self, virtapi):
     super(LibvirtVolumeDriver, self).__init__(virtapi)
     self.volume_drivers = {}
     for driver_str in CONF.libvirt_volume_drivers:
         driver_type, _sep, driver = driver_str.partition('=')
         driver_class = importutils.import_class(driver)
         self.volume_drivers[driver_type] = driver_class(self)
Ejemplo n.º 2
0
 def __init__(self, virtapi):
     super(LibvirtVolumeDriver, self).__init__(virtapi)
     self.volume_drivers = {}
     for driver_str in CONF.libvirt_volume_drivers:
         driver_type, _sep, driver = driver_str.partition('=')
         driver_class = importutils.import_class(driver)
         self.volume_drivers[driver_type] = driver_class(self)
Ejemplo n.º 3
0
    def get_class(api_name, version, version_map):
        """Returns the client class for the requested API version

        :param api_name: the name of the API, e.g. 'compute', 'image', etc
        :param version: the requested API version
        :param version_map: a dict of client classes keyed by version
        :rtype: a client class for the requested API version
        """
        try:
            client_path = version_map[str(version)]
        except (KeyError, ValueError):
            msg = _("Invalid %(api_name)s client version '%(version)s'. "
                    "Must be one of: %(version_map)s") % {
                        'api_name': api_name,
                        'version': version,
                        'version_map': ', '.join(version_map.keys())
                    }
            raise exceptions.UnsupportedVersion(msg)

        return importutils.import_class(client_path)
Ejemplo n.º 4
0
    def __init__(self, **kwargs):
        global _conn
        global _virtual_power_settings
        global _cmds

        if _cmds is None:
            LOG.debug("Setting up %s commands." % CONF.virtual_power_type)
            _vpc = "ironic.virtual_power_driver_settings.%s" % CONF.virtual_power_type
            _cmds = importutils.import_class(_vpc)
        self._vp_cmd = _cmds()
        self.connection_data = _conn
        node = kwargs.pop("node", {})
        instance = kwargs.pop("instance", {})
        self._node_name = instance.get("hostname", "")
        context = nova_context.get_admin_context()
        ifs = db.bm_interface_get_all_by_bm_node_id(context, node["id"])
        self._mac_addresses = [_normalize_mac(i["address"]) for i in ifs]
        self._connection = None
        self._matched_name = ""
        self.state = None
Ejemplo n.º 5
0
    def get_class(api_name, version, version_map):
        """Returns the client class for the requested API version

        :param api_name: the name of the API, e.g. 'compute', 'image', etc
        :param version: the requested API version
        :param version_map: a dict of client classes keyed by version
        :rtype: a client class for the requested API version
        """
        try:
            client_path = version_map[str(version)]
        except (KeyError, ValueError):
            msg = _("Invalid %(api_name)s client version '%(version)s'. "
                    "Must be one of: %(version_map)s") % {
                        'api_name': api_name,
                        'version': version,
                        'version_map': ', '.join(version_map.keys())
                    }
            raise exceptions.UnsupportedVersion(msg)

        return importutils.import_class(client_path)
Ejemplo n.º 6
0
    def __init__(self, **kwargs):
        global _conn
        global _virtual_power_settings
        global _cmds

        if _cmds is None:
            LOG.debug("Setting up %s commands." %
                    CONF.virtual_power_type)
            _vpc = 'ironic.virtual_power_driver_settings.%s' % \
                    CONF.virtual_power_type
            _cmds = importutils.import_class(_vpc)
        self._vp_cmd = _cmds()
        self.connection_data = _conn
        node = kwargs.pop('node', {})
        instance = kwargs.pop('instance', {})
        self._node_name = instance.get('hostname', "")
        context = nova_context.get_admin_context()
        ifs = db.bm_interface_get_all_by_bm_node_id(context, node['id'])
        self._mac_addresses = [_normalize_mac(i['address']) for i in ifs]
        self._connection = None
        self._matched_name = ''
        self.state = None
Ejemplo n.º 7
0
def get_power_manager(**kwargs):
    cls = importutils.import_class(CONF.power_manager)
    return cls(**kwargs)
Ejemplo n.º 8
0
def get_power_manager(**kwargs):
    cls = importutils.import_class(CONF.power_manager)
    return cls(**kwargs)