Merge "Revert "Config option to enable OVN IDL on other workers""
This commit is contained in:
commit
4952baaf6f
|
@ -197,13 +197,6 @@ ovn_opts = [
|
||||||
'or by checking the output of the following command: \n'
|
'or by checking the output of the following command: \n'
|
||||||
'ovs-appctl -t ovs-vswitchd dpif/show-dp-features '
|
'ovs-appctl -t ovs-vswitchd dpif/show-dp-features '
|
||||||
'br-int | grep "Check pkt length action".')),
|
'br-int | grep "Check pkt length action".')),
|
||||||
cfg.ListOpt('additional_worker_classes_with_ovn_idl',
|
|
||||||
default=[],
|
|
||||||
help=_('Additional worker classes to enable OVN IDLs for.\n'
|
|
||||||
'By default only the API and maintenance workers '
|
|
||||||
'have access to the IDL connections. List additional '
|
|
||||||
'worker classes here if necessary. You can use aliases '
|
|
||||||
'from neutron.worker_classes.')),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
cfg.CONF.register_opts(ovn_opts, group='ovn')
|
cfg.CONF.register_opts(ovn_opts, group='ovn')
|
||||||
|
@ -311,7 +304,3 @@ def is_ovn_emit_need_to_frag_enabled():
|
||||||
|
|
||||||
def is_igmp_snooping_enabled():
|
def is_igmp_snooping_enabled():
|
||||||
return cfg.CONF.OVS.igmp_snooping_enable
|
return cfg.CONF.OVS.igmp_snooping_enable
|
||||||
|
|
||||||
|
|
||||||
def additional_worker_classes_with_ovn_idl():
|
|
||||||
return cfg.CONF.ovn.additional_worker_classes_with_ovn_idl
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ from neutron_lib import context as n_context
|
||||||
from neutron_lib import exceptions as n_exc
|
from neutron_lib import exceptions as n_exc
|
||||||
from neutron_lib.plugins import directory
|
from neutron_lib.plugins import directory
|
||||||
from neutron_lib.plugins.ml2 import api
|
from neutron_lib.plugins.ml2 import api
|
||||||
from neutron_lib.utils import runtime
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import exception as os_db_exc
|
from oslo_db import exception as os_db_exc
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
@ -277,26 +276,8 @@ class OVNMechanismDriver(api.MechanismDriver):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def should_post_fork_initialize(worker_class):
|
def should_post_fork_initialize(worker_class):
|
||||||
# By default only API and maintenace workers need to initialize
|
return worker_class in (neutron.wsgi.WorkerService,
|
||||||
# the OVN IDL connections
|
worker.MaintenanceWorker)
|
||||||
if worker_class in (neutron.wsgi.WorkerService,
|
|
||||||
worker.MaintenanceWorker):
|
|
||||||
return True
|
|
||||||
|
|
||||||
# Configuration may allow other worker types to use IDL connections.
|
|
||||||
# Look for a match in additional_worker_classes_with_ovn_idl,
|
|
||||||
# gracefully skipping unknown classes in the config list.
|
|
||||||
for worker_type in ovn_conf.additional_worker_classes_with_ovn_idl():
|
|
||||||
try:
|
|
||||||
additional_class = runtime.load_class_by_alias_or_classname(
|
|
||||||
'neutron.worker_classes', worker_type)
|
|
||||||
if worker_class == additional_class:
|
|
||||||
return True
|
|
||||||
except ImportError:
|
|
||||||
# ignore unknown additional worker class
|
|
||||||
pass
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def post_fork_initialize(self, resource, event, trigger, payload=None):
|
def post_fork_initialize(self, resource, event, trigger, payload=None):
|
||||||
# Initialize API/Maintenance workers with OVN IDL connections
|
# Initialize API/Maintenance workers with OVN IDL connections
|
||||||
|
|
|
@ -1984,56 +1984,6 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||||
expected_candidates = [ch0.name, ch2.name]
|
expected_candidates = [ch0.name, ch2.name]
|
||||||
self.assertEqual(sorted(expected_candidates), sorted(candidates))
|
self.assertEqual(sorted(expected_candidates), sorted(candidates))
|
||||||
|
|
||||||
def _test_should_post_fork_initialize(self, enabled, disabled):
|
|
||||||
for worker_class in enabled:
|
|
||||||
self.assertTrue(
|
|
||||||
self.mech_driver.should_post_fork_initialize(worker_class))
|
|
||||||
for worker_class in disabled:
|
|
||||||
self.assertFalse(
|
|
||||||
self.mech_driver.should_post_fork_initialize(worker_class))
|
|
||||||
|
|
||||||
def test_should_post_fork_initialize_default(self):
|
|
||||||
enabled = (mech_driver.neutron.wsgi.WorkerService,
|
|
||||||
mech_driver.worker.MaintenanceWorker)
|
|
||||||
disabled = (mech_driver.neutron.service.AllServicesNeutronWorker,
|
|
||||||
mech_driver.neutron.service.RpcWorker)
|
|
||||||
self._test_should_post_fork_initialize(enabled, disabled)
|
|
||||||
|
|
||||||
def test_should_post_fork_initialize__allservices_worker(self):
|
|
||||||
ovn_conf.cfg.CONF.set_override(
|
|
||||||
'additional_worker_classes_with_ovn_idl',
|
|
||||||
['neutron.service.AllServicesNeutronWorker'],
|
|
||||||
group='ovn')
|
|
||||||
enabled = (mech_driver.neutron.wsgi.WorkerService,
|
|
||||||
mech_driver.worker.MaintenanceWorker,
|
|
||||||
mech_driver.neutron.service.AllServicesNeutronWorker)
|
|
||||||
disabled = (mech_driver.neutron.service.RpcWorker,)
|
|
||||||
self._test_should_post_fork_initialize(enabled, disabled)
|
|
||||||
|
|
||||||
def test_should_post_fork_initialize__rpc_workers(self):
|
|
||||||
ovn_conf.cfg.CONF.set_override(
|
|
||||||
'additional_worker_classes_with_ovn_idl',
|
|
||||||
['RpcWorker'],
|
|
||||||
group='ovn')
|
|
||||||
enabled = (mech_driver.neutron.wsgi.WorkerService,
|
|
||||||
mech_driver.worker.MaintenanceWorker,
|
|
||||||
mech_driver.neutron.service.RpcWorker)
|
|
||||||
disabled = (mech_driver.neutron.service.AllServicesNeutronWorker,)
|
|
||||||
self._test_should_post_fork_initialize(enabled, disabled)
|
|
||||||
|
|
||||||
def test_should_post_fork_initialize__bad_config(self):
|
|
||||||
# test that `should_post_fork_initialize` works even with
|
|
||||||
# unknown alias in additional_worker_classes_with_ovn_idl
|
|
||||||
ovn_conf.cfg.CONF.set_override(
|
|
||||||
'additional_worker_classes_with_ovn_idl',
|
|
||||||
['UnknownAlias'],
|
|
||||||
group='ovn')
|
|
||||||
enabled = (mech_driver.neutron.wsgi.WorkerService,
|
|
||||||
mech_driver.worker.MaintenanceWorker)
|
|
||||||
disabled = (mech_driver.neutron.service.AllServicesNeutronWorker,
|
|
||||||
mech_driver.neutron.service.RpcWorker)
|
|
||||||
self._test_should_post_fork_initialize(enabled, disabled)
|
|
||||||
|
|
||||||
|
|
||||||
class OVNMechanismDriverTestCase(test_plugin.Ml2PluginV2TestCase):
|
class OVNMechanismDriverTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||||
_mechanism_drivers = ['logger', 'ovn']
|
_mechanism_drivers = ['logger', 'ovn']
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
other:
|
|
||||||
- |
|
|
||||||
Added a new config option ``additional_worker_classes_with_ovn_idl``
|
|
||||||
to allow initialization of OVN IDL connections for additional worker
|
|
||||||
classes. Can be used for plugins or extensions that need IDL connections
|
|
||||||
for other worker classes than API and maintenance workers.
|
|
|
@ -269,9 +269,3 @@ neutron.objects =
|
||||||
Trunk = neutron.objects.trunk:Trunk
|
Trunk = neutron.objects.trunk:Trunk
|
||||||
neutron.status.upgrade.checks =
|
neutron.status.upgrade.checks =
|
||||||
neutron = neutron.cmd.upgrade_checks.checks:CoreChecks
|
neutron = neutron.cmd.upgrade_checks.checks:CoreChecks
|
||||||
neutron.worker_classes =
|
|
||||||
APIWorker = neutron.wsgi:WorkerService
|
|
||||||
RpcWorker = neutron.service:RpcWorker
|
|
||||||
RpcReportsWorker = neutron.service:RpcReportsWorker
|
|
||||||
AllServicesNeutronWorker = neutron.service:AllServicesNeutronWorker
|
|
||||||
MaintenanceWorker = neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.worker:MaintenanceWorker
|
|
||||||
|
|
Loading…
Reference in New Issue