def __init__(self, conf=None):
        """Initializes local configuration of the Hyper-V Neutron Agent.

        :param conf: dict or dict-like object containing the configuration
                     details used by this Agent. If None is specified, default
                     values are used instead. conf format is as follows:
        {
            'host': string,
            'AGENT': {'polling_interval': int,
                       'local_network_vswitch': string,
                       'physical_network_vswitch_mappings': array,
                       'enable_metrics_collection': boolean,
                       'metrics_max_retries': int},
            'SECURITYGROUP': {'enable_security_group': boolean}
        }

        For more information on the arguments, their meaning and their default
        values, visit: http://docs.openstack.org/juno/config-reference/content/
networking-plugin-hyperv_agent.html
        """

        super(HyperVNeutronAgentMixin, self).__init__()
        self._metricsutils = utilsfactory.get_metricsutils()
        self._utils = utilsfactory.get_networkutils()
        self._utils.init_caches()
        self._network_vswitch_map = {}
        self._port_metric_retries = {}

        self._nvgre_enabled = False
        self._cache_lock = threading.Lock()

        conf = conf or {}
        agent_conf = conf.get('AGENT', {})
        security_conf = conf.get('SECURITYGROUP', {})

        self._host = conf.get('host', None)

        self._polling_interval = agent_conf.get('polling_interval', 2)
        self._local_network_vswitch = agent_conf.get('local_network_vswitch',
                                                     'private')
        self._worker_count = agent_conf.get('worker_count')
        self._phys_net_map = agent_conf.get(
            'physical_network_vswitch_mappings', [])
        self.enable_metrics_collection = agent_conf.get(
            'enable_metrics_collection', False)
        self._metrics_max_retries = agent_conf.get('metrics_max_retries', 100)

        self.enable_security_groups = security_conf.get(
            'enable_security_group', False)

        tpool.set_num_threads(self._worker_count)

        self._load_physical_network_mappings(self._phys_net_map)
        self._init_nvgre()
예제 #2
0
    def __init__(self, conf=None):
        """Initializes local configuration of the Hyper-V Neutron Agent.

        :param conf: dict or dict-like object containing the configuration
                     details used by this Agent. If None is specified, default
                     values are used instead. conf format is as follows:
        {
            'host': string,
            'AGENT': {'polling_interval': int,
                       'local_network_vswitch': string,
                       'physical_network_vswitch_mappings': array,
                       'enable_metrics_collection': boolean,
                       'metrics_max_retries': int},
            'SECURITYGROUP': {'enable_security_group': boolean}
        }

        For more information on the arguments, their meaning and their default
        values, visit: http://docs.openstack.org/juno/config-reference/content/
networking-plugin-hyperv_agent.html
        """

        super(HyperVNeutronAgentMixin, self).__init__()
        self._metricsutils = utilsfactory.get_metricsutils()
        self._utils = utilsfactory.get_networkutils()
        self._utils.init_caches()
        self._network_vswitch_map = {}
        self._port_metric_retries = {}

        self._nvgre_enabled = False
        self._cache_lock = threading.Lock()

        conf = conf or {}
        agent_conf = conf.get('AGENT', {})
        security_conf = conf.get('SECURITYGROUP', {})

        self._host = conf.get('host', None)

        self._polling_interval = agent_conf.get('polling_interval', 2)
        self._local_network_vswitch = agent_conf.get('local_network_vswitch',
                                                     'private')
        self._worker_count = agent_conf.get('worker_count')
        self._phys_net_map = agent_conf.get(
            'physical_network_vswitch_mappings', [])
        self.enable_metrics_collection = agent_conf.get(
            'enable_metrics_collection', False)
        self._metrics_max_retries = agent_conf.get('metrics_max_retries', 100)

        self.enable_security_groups = security_conf.get(
            'enable_security_group', False)

        tpool.set_num_threads(self._worker_count)

        self._load_physical_network_mappings(self._phys_net_map)
예제 #3
0
    def _setup(self):
        """Setup the layer two agent."""
        agent_config = CONF.get("AGENT", {})
        self._worker_count = agent_config.get('worker_count')
        self._phys_net_map = agent_config.get(
            'physical_network_vswitch_mappings', [])
        self._local_network_vswitch = agent_config.get('local_network_vswitch',
                                                       'private')
        self._load_physical_network_mappings(self._phys_net_map)

        self._endpoints.append(self)
        self._event_callback_pairs.extend([
            (self._utils.EVENT_TYPE_CREATE, self._process_added_port_event),
            (self._utils.EVENT_TYPE_DELETE, self._process_removed_port_event)
        ])

        tpool.set_num_threads(self._worker_count)
예제 #4
0
 def test_tpool_set_num_threads(self):
     tpool.set_num_threads(5)
     self.assertEqual(5, tpool._nthreads)
예제 #5
0
 def _set_tpool_size(self, nthreads: int) -> None:
     # NOTE(geguileo): Until PR #472 is merged we have to be very careful
     # not to call "tpool.execute" before calling this method.
     tpool.set_num_threads(nthreads)
예제 #6
0
 def test_tpool_set_num_threads(self):
     tpool.set_num_threads(5)
     self.assertEqual(5, tpool._nthreads)
예제 #7
0
 def _set_tpool_size(self, nthreads):
     # NOTE(geguileo): Until PR #472 is merged we have to be very careful
     # not to call "tpool.execute" before calling this method.
     tpool.set_num_threads(nthreads)