def __init__(self, plugin):
        super(HaproxyNSDriver, self).__init__(plugin)
        self.conf = cfg.CONF
        self.state_path = os.path.join(
            self.conf.haproxy.loadbalancer_state_path, STATE_PATH_V2_APPEND)
        if not self.conf.haproxy.interface_driver:
            self.conf.haproxy.interface_driver = DEFAULT_INTERFACE_DRIVER
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                'neutron.interface_drivers',
                self.conf.haproxy.interface_driver)

        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_LE('Error importing interface driver: %s')
                       % self.conf.haproxy.interface_driver)
                LOG.exception(msg)
        self.vif_driver = vif_driver_class(self.conf)

        # instantiate managers here
        self.load_balancer = LoadBalancerManager(self)
        self.listener = ListenerManager(self)
        self.pool = PoolManager(self)
        self.member = MemberManager(self)
        self.health_monitor = HealthMonitorManager(self)

        self.admin_ctx = ncontext.get_admin_context()
        self.deployed_loadbalancer_ids = set()
        self._deploy_existing_instances()

        SimpleHaproxyStatsService(self).start()
    def __init__(self, plugin):
        super(HaproxyNSDriver, self).__init__(plugin)
        self.conf = cfg.CONF
        self.state_path = os.path.join(
            self.conf.haproxy.loadbalancer_state_path, STATE_PATH_V2_APPEND)
        if not self.conf.haproxy.interface_driver:
            self.conf.haproxy.interface_driver = DEFAULT_INTERFACE_DRIVER
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                'neutron.interface_drivers',
                self.conf.haproxy.interface_driver)

        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_LE('Error importing interface driver: %s') %
                       self.conf.haproxy.interface_driver)
                LOG.exception(msg)
        self.vif_driver = vif_driver_class(self.conf)

        # instantiate managers here
        self.load_balancer = LoadBalancerManager(self)
        self.listener = ListenerManager(self)
        self.pool = PoolManager(self)
        self.member = MemberManager(self)
        self.health_monitor = HealthMonitorManager(self)

        self.admin_ctx = ncontext.get_admin_context()
        self.deployed_loadbalancer_ids = set()
        self._deploy_existing_instances()

        SimpleHaproxyStatsService(self).start()
Exemplo n.º 3
0
 def __init__(self):
     super(TricirclePlugin, self).__init__()
     core_plugins_namespace = 'neutron.core_plugins'
     plugin_provider = cfg.CONF.tricircle.real_core_plugin
     plugin_class = utils.load_class_by_alias_or_classname(
         core_plugins_namespace, plugin_provider)
     self.core_plugin = plugin_class()
     self.neutron_handle = resource_handle.NeutronResourceHandle(
         cfg.CONF.client.auth_url)
     self.neutron_handle.endpoint_url = \
         cfg.CONF.tricircle.central_neutron_url
Exemplo n.º 4
0
 def __init__(self):
     super(TricirclePlugin, self).__init__()
     core_plugins_namespace = 'neutron.core_plugins'
     plugin_provider = cfg.CONF.tricircle.real_core_plugin
     plugin_class = utils.load_class_by_alias_or_classname(
         core_plugins_namespace, plugin_provider)
     self.core_plugin = plugin_class()
     self.neutron_handle = resource_handle.NeutronResourceHandle(
         cfg.CONF.client.auth_url)
     self.neutron_handle.endpoint_url = \
         cfg.CONF.tricircle.central_neutron_url
Exemplo n.º 5
0
    def load_class_for_provider(namespace, plugin_provider):
        """Loads plugin using alias or class name
        :param namespace: namespace where alias is defined
        :param plugin_provider: plugin alias or class name
        :returns plugin that is loaded
        :raises ImportError if fails to load plugin
        """

        try:
            return utils.load_class_by_alias_or_classname(namespace, plugin_provider)
        except ImportError:
            raise ImportError(_("Plugin '%s' not found.") % plugin_provider)
Exemplo n.º 6
0
    def _load_firewall_extension_driver(namespace, driver):
        """Loads driver using alias or class name
        :param namespace: namespace where alias is defined
        :param driver: driver alias or class name
        :returns driver that is loaded
        :raises ImportError if fails to load driver
        """

        try:
            return utils.load_class_by_alias_or_classname(namespace, driver)
        except ImportError:
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Driver '%s' not found."), driver)
Exemplo n.º 7
0
    def load_class_for_provider(namespace, plugin_provider):
        """Loads plugin using alias or class name
        :param namespace: namespace where alias is defined
        :param plugin_provider: plugin alias or class name
        :returns plugin that is loaded
        :raises ImportError if fails to load plugin
        """

        try:
            return utils.load_class_by_alias_or_classname(
                namespace, plugin_provider)
        except ImportError:
            raise ImportError(_("Plugin '%s' not found.") % plugin_provider)
Exemplo n.º 8
0
    def __init__(self):
        super(TricirclePlugin, self).__init__()
        core_plugins_namespace = 'neutron.core_plugins'
        plugin_provider = cfg.CONF.tricircle.real_core_plugin
        plugin_class = utils.load_class_by_alias_or_classname(
            core_plugins_namespace, plugin_provider)
        self.core_plugin = plugin_class()
        self.neutron_handle = resource_handle.NeutronResourceHandle(
            cfg.CONF.client.auth_url)
        self.neutron_handle.endpoint_url = \
            cfg.CONF.tricircle.central_neutron_url
#        self.on_trunk_create = {}
#        self.on_subnet_delete = {}
#
        self.tricircle_handle = resource_handle.NeutronResourceHandle(
            cfg.CONF.client.auth_url,'1.0')
        self.tricircle_handle.endpoint_url = \
            cfg.CONF.tricircle.tricircle_url


        for field in (callbacks_resources.NETWORK,callbacks_resources.SUBNET,
                      callbacks_resources.PORT,callbacks_resources.ROUTER):
            callbacks_registry.subscribe(
                self.after_resource_create,
                field,
                callbacks_events.AFTER_CREATE)
            callbacks_registry.subscribe(
                self.after_resource_update,
                field,
                callbacks_events.AFTER_UPDATE)

        callbacks_registry.subscribe(
            self.after_network_delete,
            callbacks_resources.NETWORK,
            callbacks_events.AFTER_DELETE)

        callbacks_registry.subscribe(
            self.after_router_delete,
            callbacks_resources.ROUTER,
            callbacks_events.AFTER_DELETE)

        callbacks_registry.subscribe(
            self.after_subnet_delete,
            callbacks_resources.SUBNET,
            callbacks_events.AFTER_DELETE)

        callbacks_registry.subscribe(
            self.after_port_delete,
            callbacks_resources.PORT,
            callbacks_events.AFTER_DELETE)
Exemplo n.º 9
0
def load_interface_driver(conf):
    """Load interface driver for agents like DHCP or L3 agent.

    :param conf: driver configuration object
    :raises SystemExit of 1 if driver cannot be loaded
    """

    try:
        loaded_class = neutron_utils.load_class_by_alias_or_classname(
            INTERFACE_NAMESPACE, conf.interface_driver)
        return loaded_class(conf)
    except ImportError:
        LOG.error("Error loading interface driver '%s'", conf.interface_driver)
        raise SystemExit(1)
Exemplo n.º 10
0
    def load_class_for_provider(namespace, plugin_provider):
        """Loads plugin using alias or class name

        :param namespace: namespace where alias is defined
        :param plugin_provider: plugin alias or class name
        :returns: plugin that is loaded
        :raises ImportError: if fails to load plugin
        """

        try:
            return utils.load_class_by_alias_or_classname(namespace,
                    plugin_provider)
        except ImportError:
            with excutils.save_and_reraise_exception():
                LOG.error("Plugin '%s' not found.", plugin_provider)
Exemplo n.º 11
0
    def load_class_for_provider(namespace, plugin_provider):
        """Loads plugin using alias or class name

        :param namespace: namespace where alias is defined
        :param plugin_provider: plugin alias or class name
        :returns: plugin that is loaded
        :raises ImportError: if fails to load plugin
        """

        try:
            return utils.load_class_by_alias_or_classname(namespace,
                    plugin_provider)
        except ImportError:
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Plugin '%s' not found."), plugin_provider)
Exemplo n.º 12
0
    def __init__(self, conf, plugin_rpc):
        self.conf = conf
        self.state_path = conf.haproxy.loadbalancer_state_path
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                'neutron.interface_drivers', conf.interface_driver)
        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_('Error importing interface driver: %s') %
                       conf.interface_driver)
                LOG.error(msg)

        self.vif_driver = vif_driver_class(conf)
        self.plugin_rpc = plugin_rpc
        self.pool_to_port_id = {}
Exemplo n.º 13
0
def load_metering_driver(plugin, conf):
    """Load metering driver

    :param plugin: the metering plugin
    :param conf: driver configuration object
    :raises SystemExit of 1 if driver cannot be loaded
    """

    try:
        loaded_class = utils.load_class_by_alias_or_classname(
            METERING_NAMESPACE, conf.driver)
        return loaded_class(plugin, conf)
    except ImportError:
        LOG.error("Error loading metering driver '%s'", conf.driver)
        raise SystemExit(1)
Exemplo n.º 14
0
def load_interface_driver(conf):
    """Load interface driver for agents like DHCP or L3 agent.

    :param conf: driver configuration object
    :raises SystemExit of 1 if driver cannot be loaded
    """

    try:
        loaded_class = neutron_utils.load_class_by_alias_or_classname(
                INTERFACE_NAMESPACE, conf.interface_driver)
        return loaded_class(conf)
    except ImportError:
        LOG.error(_LE("Error loading interface driver '%s'"),
                  conf.interface_driver)
        raise SystemExit(1)
Exemplo n.º 15
0
    def __init__(self, conf, plugin_rpc):
        self.conf = conf
        self.state_path = conf.haproxy.loadbalancer_state_path
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                'neutron.interface_drivers',
                conf.interface_driver)
        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_('Error importing interface driver: %s')
                       % conf.interface_driver)
                LOG.error(msg)

        self.vif_driver = vif_driver_class(conf)
        self.plugin_rpc = plugin_rpc
        self.pool_to_port_id = {}
Exemplo n.º 16
0
def load_metering_driver(plugin, conf):
    """Load metering driver

    :param plugin: the metering plugin
    :param conf: driver configuration object
    :raises SystemExit of 1 if driver cannot be loaded
    """

    try:
        loaded_class = utils.load_class_by_alias_or_classname(
                METERING_NAMESPACE, conf.driver)
        return loaded_class(plugin, conf)
    except ImportError:
        LOG.error(_LE("Error loading metering driver '%s'"),
                  conf.driver)
        raise SystemExit(1)
Exemplo n.º 17
0
    def __init__(self, conf, plugin_rpc):
        super(HaproxyNSDriver, self).__init__(conf, plugin_rpc)
        self.state_path = conf.haproxy.loadbalancer_state_path
        self.state_path = os.path.join(self.conf.haproxy.loadbalancer_state_path, STATE_PATH_V2_APPEND)
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                "neutron.interface_drivers", conf.interface_driver
            )
        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = _("Error importing interface driver: %s") % conf.interface_driver
                LOG.error(msg)

        self.vif_driver = vif_driver_class(conf)
        self.deployed_loadbalancers = {}
        self._loadbalancer = LoadBalancerManager(self)
        self._listener = ListenerManager(self)
        self._pool = PoolManager(self)
        self._member = MemberManager(self)
        self._healthmonitor = HealthMonitorManager(self)
Exemplo n.º 18
0
    def __init__(self, conf, plugin_rpc):
        super(HaproxyNSDriver, self).__init__(conf, plugin_rpc)
        self.state_path = conf.haproxy.loadbalancer_state_path
        self.state_path = os.path.join(
            self.conf.haproxy.loadbalancer_state_path, STATE_PATH_V2_APPEND)
        try:
            vif_driver_class = n_utils.load_class_by_alias_or_classname(
                'neutron.interface_drivers', conf.interface_driver)
        except ImportError:
            with excutils.save_and_reraise_exception():
                msg = (_('Error importing interface driver: %s') %
                       conf.interface_driver)
                LOG.error(msg)

        self.vif_driver = vif_driver_class(conf)
        self.deployed_loadbalancers = {}
        self._loadbalancer = LoadBalancerManager(self)
        self._listener = ListenerManager(self)
        self._pool = PoolManager(self)
        self._member = MemberManager(self)
        self._healthmonitor = HealthMonitorManager(self)
Exemplo n.º 19
0
def load_firewall_driver_class(driver):
    return utils.load_class_by_alias_or_classname(
        'neutron.agent.firewall_drivers', driver)
Exemplo n.º 20
0
def load_firewall_driver_class(driver):
    return utils.load_class_by_alias_or_classname(
        'neutron.agent.firewall_drivers', driver)