Add a new option to skip loading Trunk extension

On OVS agent, trunk extension is always loaded. If trunk plugin is not
enabled server side, we don't want to enable extension on agent side.
It will avoid declaration of RPCServer for Trunk and SubPort objects.

To effectively disable the trunk extension, let's introduce a new
parameter under [OVS] group so that an operator turn that setting off.

The default value will stay True for now to keep backward compatibility
with previous deployments.

Closes-bug: #2058712
Change-Id: I94602d5f3159d9a2d5b988c9ab6cdd20dfd4af5b
Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
This commit is contained in:
Julien Cosmao
2024-04-08 13:32:13 +00:00
committed by Arnaud Morin
parent 10b0973551
commit 90d5b388e1
5 changed files with 58 additions and 5 deletions

View File

@@ -72,6 +72,20 @@ Controller node
[DEFAULT]
service_plugins = trunk
Compute node
------------
* If you are using the ``Open vSwitch`` mechanism driver, then you can
verify the value of ``trunk_enabled`` flag in
``/etc/neutron/plugins/ml2/openvswitch_agent.ini`` config file.
Note that ``True`` is the default value, but you can overwrite this
option like this:
.. code-block:: ini
[OVS]
trunk_enabled = True
Verify service operation
------------------------

View File

@@ -185,6 +185,11 @@ ovs_opts = [
"limit features which will add meter kbps rules "
"and apply them to the OpenFlow flow table "
"BANDWIDTH_RATE_LIMIT for VM ports."),
cfg.BoolOpt('trunk_enabled', default=True,
help=_('Enable agent side trunk extension. If you do not '
'need the trunk extension, you can safely set '
'config option to False, it will avoid the agent '
'to declare some queues.')),
]
agent_opts = [

View File

@@ -93,13 +93,13 @@ class OVSTrunkSkeleton(agent.TrunkSkeleton):
def init_handler(resource, event, trigger, payload=None):
"""Handler for agent init event."""
# Set up agent-side RPC for receiving trunk events; we may want to
# make this setup conditional based on server-side capabilities.
global TRUNK_SKELETON
manager = trunk_manager.TrunkManager(trigger.int_br)
handler = ovsdb_handler.OVSDBHandler(manager)
TRUNK_SKELETON = OVSTrunkSkeleton(handler)
if cfg.CONF.OVS.trunk_enabled:
LOG.info("Registering Trunk extension")
manager = trunk_manager.TrunkManager(trigger.int_br)
handler = ovsdb_handler.OVSDBHandler(manager)
TRUNK_SKELETON = OVSTrunkSkeleton(handler)
def unregister():

View File

@@ -13,6 +13,7 @@
from unittest import mock
from oslo_config import cfg
import oslo_messaging
from oslo_utils import uuidutils
@@ -137,3 +138,25 @@ class OvsTrunkSkeletonTest(base.BaseTestCase):
self.skeleton.ovsdb_handler, 'unwire_subports_for_trunk'):
self._test_handle_subports_trunk_on_trunk_update(
events.DELETED)
class InitHandlerTest(base.BaseTestCase):
def setUp(self):
super().setUp()
# Unset the driver to avoid race condition between tests
driver.TRUNK_SKELETON = None
def test_init_handler_plugin_default(self):
driver.init_handler(mock.Mock(), mock.Mock(), mock.Mock(), None)
self.assertIsInstance(driver.TRUNK_SKELETON, driver.OVSTrunkSkeleton)
def test_init_handler_plugin_disabled(self):
cfg.CONF.set_override('trunk_enabled', False, group='OVS')
driver.init_handler(mock.Mock(), mock.Mock(), mock.Mock(), None)
self.assertFalse(driver.TRUNK_SKELETON)
def test_init_handler_plugin_enabled(self):
cfg.CONF.set_override('trunk_enabled', True, group='OVS')
driver.init_handler(mock.Mock(), mock.Mock(), mock.Mock(), None)
self.assertIsInstance(driver.TRUNK_SKELETON, driver.OVSTrunkSkeleton)

View File

@@ -0,0 +1,11 @@
---
features:
- |
An new option name ``trunk_enabled`` has been added to
``neutron-openvswitch-agent`` under ``OVS`` group. This new option can be
set to ``False`` in order to disable loading the ``trunk`` extension on
agent side. The default value for this option is ``True`` to keep backward
compatibility with previous deployments. The recommendation is to set this
option to ``False`` if you do not use the ``trunk`` extension, so that
the number of queues created by the RPCServer will reduce. This can have
a very good impact on large-scale scenario using RabbitMQ message broker.