Merge "Use openvswitch interface driver by default"

This commit is contained in:
Zuul 2025-03-11 20:56:11 +00:00 committed by Gerrit Code Review
commit 5a573dccb6
23 changed files with 51 additions and 116 deletions

View File

@ -129,7 +129,6 @@ Network nodes
[DEFAULT] [DEFAULT]
ha_vrrp_auth_password = password ha_vrrp_auth_password = password
interface_driver = openvswitch
agent_mode = dvr_snat agent_mode = dvr_snat
@ -158,7 +157,6 @@ Compute nodes
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
interface_driver = openvswitch
agent_mode = dvr agent_mode = dvr
Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface

View File

@ -134,7 +134,6 @@ Compute nodes
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
interface_driver = openvswitch
agent_mode = dvr agent_mode = dvr
#. Restart the following services: #. Restart the following services:

View File

@ -113,13 +113,6 @@ Network node 2
Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the
interface that handles VXLAN overlays for self-service networks. interface that handles VXLAN overlays for self-service networks.
#. In the ``l3_agent.ini`` file, configure the layer-3 agent.
.. code-block:: ini
[DEFAULT]
interface_driver = openvswitch
#. Start the following services: #. Start the following services:
* Open vSwitch agent * Open vSwitch agent

View File

@ -184,7 +184,6 @@ Compute nodes
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
interface_driver = openvswitch
enable_isolated_metadata = True enable_isolated_metadata = True
force_metadata = True force_metadata = True

View File

@ -143,13 +143,6 @@ Network node
Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the
interface that handles VXLAN overlays for self-service networks. interface that handles VXLAN overlays for self-service networks.
#. In the ``l3_agent.ini`` file, configure the layer-3 agent.
.. code-block:: ini
[DEFAULT]
interface_driver = openvswitch
#. Start the following services: #. Start the following services:
* Open vSwitch agent * Open vSwitch agent

View File

@ -535,12 +535,15 @@ Interface (VIF) drivers for the reference implementations are defined in
defined in a similar location within their own repo. defined in a similar location within their own repo.
The entry point for the interface driver is a Neutron config option. It is up The entry point for the interface driver is a Neutron config option. It is up
to the installer to configure this item in the ``[default]`` section. to the installer to configure this item in the ``[DEFAULT]`` section.
For example:: For example::
[default] [DEFAULT]
interface_driver = networking_foo.agent.linux.interface.FooInterfaceDriver interface_driver = networking_foo.agent.linux.interface.FooInterfaceDriver
The ``openvswitch`` interface driver is used by default in case the option is
not explicitly set.
**ToDo: Interface Driver port bindings.** **ToDo: Interface Driver port bindings.**
``VIF_TYPE_*`` constants in ``neutron_lib/api/definitions/portbindings.py`` should be ``VIF_TYPE_*`` constants in ``neutron_lib/api/definitions/portbindings.py`` should be
moved from neutron core to the repositories where their drivers are moved from neutron core to the repositories where their drivers are

View File

@ -288,16 +288,15 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -286,16 +286,16 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -287,16 +287,15 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -318,19 +318,9 @@ Configure the layer-3 agent
The Layer-3 (L3) agent provides routing and NAT services for The Layer-3 (L3) agent provides routing and NAT services for
self-service virtual networks. self-service virtual networks.
* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following * Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization
actions: is needed.
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver:
.. path /etc/neutron/l3_agent.ini
.. code-block:: ini
[DEFAULT]
# ...
interface_driver = openvswitch
.. end
Configure the DHCP agent Configure the DHCP agent
------------------------ ------------------------
@ -340,16 +330,15 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -320,19 +320,8 @@ Configure the layer-3 agent
The Layer-3 (L3) agent provides routing and NAT services for The Layer-3 (L3) agent provides routing and NAT services for
self-service virtual networks. self-service virtual networks.
* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following * Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization
actions: is needed.
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver:
.. path /etc/neutron/l3_agent.ini
.. code-block:: ini
[DEFAULT]
# ...
interface_driver = openvswitch
.. end
Configure the DHCP agent Configure the DHCP agent
------------------------ ------------------------
@ -342,16 +331,15 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, * In the ``[DEFAULT]`` section, configure Dnsmasq DHCP driver, and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -321,19 +321,8 @@ Configure the layer-3 agent
The Layer-3 (L3) agent provides routing and NAT services for The Layer-3 (L3) agent provides routing and NAT services for
self-service virtual networks. self-service virtual networks.
* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following * Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization
actions: is needed.
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver:
.. path /etc/neutron/l3_agent.ini
.. code-block:: ini
[DEFAULT]
# ...
interface_driver = openvswitch
.. end
Configure the DHCP agent Configure the DHCP agent
------------------------ ------------------------
@ -343,16 +332,15 @@ The DHCP agent provides DHCP services for virtual networks.
* Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following * Edit the ``/etc/neutron/dhcp_agent.ini`` file and complete the following
actions: actions:
* In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, * In the ``[DEFAULT]`` section, configure Dnsmasq DHCP driver, and enable
Dnsmasq DHCP driver, and enable isolated metadata so instances on provider isolated metadata so instances on provider networks can access metadata
networks can access metadata over the network: over the network:
.. path /etc/neutron/dhcp_agent.ini .. path /etc/neutron/dhcp_agent.ini
.. code-block:: ini .. code-block:: ini
[DEFAULT] [DEFAULT]
# ... # ...
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true enable_isolated_metadata = true

View File

@ -95,6 +95,7 @@ AGENT_STATE_OPTS = [
INTERFACE_DRIVER_OPTS = [ INTERFACE_DRIVER_OPTS = [
cfg.StrOpt('interface_driver', cfg.StrOpt('interface_driver',
default='openvswitch',
help=_("The driver used to manage virtual interfaces.")), help=_("The driver used to manage virtual interfaces.")),
] ]
@ -152,16 +153,16 @@ DHCP_PROTOCOL_OPTS = [
] ]
def register_external_process_opts(cfg=cfg.CONF): def register_external_process_opts(conf=cfg.CONF):
cfg.register_opts(EXTERNAL_PROCESS_OPTS) conf.register_opts(EXTERNAL_PROCESS_OPTS)
def register_interface_opts(cfg=cfg.CONF): def register_interface_opts(conf=cfg.CONF):
cfg.register_opts(INTERFACE_OPTS) conf.register_opts(INTERFACE_OPTS)
def register_ra_opts(cfg=cfg.CONF): def register_ra_opts(conf=cfg.CONF):
cfg.register_opts(RA_OPTS) conf.register_opts(RA_OPTS)
def register_root_helper(conf=cfg.CONF): def register_root_helper(conf=cfg.CONF):

View File

@ -420,8 +420,6 @@ class L3ConfigFixture(ConfigFixture):
def _prepare_config_with_ovs_agent(self, integration_bridge): def _prepare_config_with_ovs_agent(self, integration_bridge):
self.config.update({ self.config.update({
'DEFAULT': { 'DEFAULT': {
'interface_driver': ('neutron.agent.linux.interface.'
'OVSInterfaceDriver'),
}, },
'OVS': { 'OVS': {
'integration_bridge': integration_bridge, 'integration_bridge': integration_bridge,
@ -457,7 +455,6 @@ class DhcpConfigFixture(ConfigFixture):
def _prepare_config_with_ovs_agent(self, integration_bridge): def _prepare_config_with_ovs_agent(self, integration_bridge):
self.config.update({ self.config.update({
'DEFAULT': { 'DEFAULT': {
'interface_driver': 'openvswitch',
}, },
'OVS': { 'OVS': {
'integration_bridge': integration_bridge, 'integration_bridge': integration_bridge,

View File

@ -146,9 +146,6 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase, OVSOFControllerHelper):
def _configure_agent(self): def _configure_agent(self):
config = self._get_config_opts() config = self._get_config_opts()
config.set_override(
'interface_driver',
'neutron.agent.linux.interface.OVSInterfaceDriver')
config.set_override('integration_bridge', self.br_int, "OVS") config.set_override('integration_bridge', self.br_int, "OVS")
config.set_override('tunnel_bridge', self.br_tun, "OVS") config.set_override('tunnel_bridge', self.br_tun, "OVS")
config.set_override('int_peer_patch_port', self.patch_tun, "OVS") config.set_override('int_peer_patch_port', self.patch_tun, "OVS")

View File

@ -49,8 +49,6 @@ LOG = logging.getLogger(__name__)
_uuid = uuidutils.generate_uuid _uuid = uuidutils.generate_uuid
OVS_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver'
KEEPALIVED_CONFIG = """\ KEEPALIVED_CONFIG = """\
global_defs { global_defs {
notification_email_from %(email_from)s notification_email_from %(email_from)s
@ -90,7 +88,6 @@ def get_ovs_bridge(br_name):
class L3AgentTestFramework(base.BaseSudoTestCase): class L3AgentTestFramework(base.BaseSudoTestCase):
INTERFACE_DRIVER = OVS_INTERFACE_DRIVER
NESTED_NAMESPACE_SEPARATOR = '@' NESTED_NAMESPACE_SEPARATOR = '@'
def setUp(self): def setUp(self):
@ -117,7 +114,6 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
def _configure_agent(self, host, agent_mode='dvr_snat'): def _configure_agent(self, host, agent_mode='dvr_snat'):
conf = self._get_config_opts() conf = self._get_config_opts()
l3_agent_main.register_opts(conf) l3_agent_main.register_opts(conf)
conf.set_override('interface_driver', self.INTERFACE_DRIVER)
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
conf.set_override('integration_bridge', br_int.br_name, 'OVS') conf.set_override('integration_bridge', br_int.br_name, 'OVS')

View File

@ -39,7 +39,6 @@ class TestDhcp(functional_base.BaseSudoTestCase):
conf.register_opts(common_conf.core_opts) conf.register_opts(common_conf.core_opts)
conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS) conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS)
ovs_conf.register_ovs_opts(conf) ovs_conf.register_ovs_opts(conf)
conf.set_override('interface_driver', 'openvswitch')
conf.set_override('host', 'foo-host') conf.set_override('host', 'foo-host')
self.conf = conf self.conf = conf
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge

View File

@ -62,6 +62,9 @@ class IpLibTestFramework(functional_base.BaseSudoTestCase):
def _configure(self): def _configure(self):
config.register_interface_driver_opts_helper(cfg.CONF) config.register_interface_driver_opts_helper(cfg.CONF)
# TODO(tkajinam): This is not needed theoretically but for some reasons
# the option defaults to None in tests. Make sure the expected default
# is used to avoid failure in the following import_object.
cfg.CONF.set_override( cfg.CONF.set_override(
'interface_driver', 'interface_driver',
'neutron.agent.linux.interface.OVSInterfaceDriver') 'neutron.agent.linux.interface.OVSInterfaceDriver')

View File

@ -33,7 +33,6 @@ from neutron.tests.functional import base
from neutron.tests.functional.cmd import process_spawn from neutron.tests.functional.cmd import process_spawn
GET_NAMESPACES = 'neutron.agent.linux.ip_lib.list_network_namespaces' GET_NAMESPACES = 'neutron.agent.linux.ip_lib.list_network_namespaces'
TEST_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver'
NUM_SUBPROCESSES = 6 NUM_SUBPROCESSES = 6
@ -52,7 +51,6 @@ class NetnsCleanupTest(base.BaseSudoTestCase):
args.append('--force') args.append('--force')
self.conf = netns_cleanup.setup_conf() self.conf = netns_cleanup.setup_conf()
self.conf.set_override('interface_driver', TEST_INTERFACE_DRIVER)
self.config_parse(conf=self.conf, args=args) self.config_parse(conf=self.conf, args=args)
def test_cleanup_network_namespaces_cleans_dhcp_and_l3_namespaces(self): def test_cleanup_network_namespaces_cleans_dhcp_and_l3_namespaces(self):

View File

@ -34,10 +34,6 @@ class TestLoadInterfaceDriver(base.BaseTestCase):
config.register_interface_opts(self.conf) config.register_interface_opts(self.conf)
config.register_interface_driver_opts_helper(self.conf) config.register_interface_driver_opts_helper(self.conf)
def test_load_interface_driver_not_set(self):
with testlib_api.ExpectedException(SystemExit):
utils.load_interface_driver(self.conf)
def test_load_interface_driver_wrong_driver(self): def test_load_interface_driver_wrong_driver(self):
self.conf.set_override('interface_driver', 'neutron.NonExistentDriver') self.conf.set_override('interface_driver', 'neutron.NonExistentDriver')
with testlib_api.ExpectedException(SystemExit): with testlib_api.ExpectedException(SystemExit):
@ -51,6 +47,10 @@ class TestLoadInterfaceDriver(base.BaseTestCase):
with testlib_api.ExpectedException(RuntimeError): with testlib_api.ExpectedException(RuntimeError):
utils.load_interface_driver(self.conf) utils.load_interface_driver(self.conf)
def test_load_interface_driver_default(self):
self.assertIsInstance(utils.load_interface_driver(self.conf),
interface.OVSInterfaceDriver)
def test_load_interface_driver_success(self): def test_load_interface_driver_success(self):
self.conf.set_override('interface_driver', self.conf.set_override('interface_driver',
'neutron.agent.linux.interface.NullDriver') 'neutron.agent.linux.interface.NullDriver')

View File

@ -814,11 +814,6 @@ class TestDhcpAgent(base.BaseTestCase):
self.assertEqual(set(networks), set(dhcp.cache.get_network_ids())) self.assertEqual(set(networks), set(dhcp.cache.get_network_ids()))
def test_none_interface_driver(self):
cfg.CONF.set_override('interface_driver', None)
self.assertRaises(SystemExit, dhcp.DeviceManager,
cfg.CONF, mock.Mock())
def test_nonexistent_interface_driver(self): def test_nonexistent_interface_driver(self):
# Temporarily turn off mock, so could use the real import_class # Temporarily turn off mock, so could use the real import_class
# to import interface_driver. # to import interface_driver.
@ -832,10 +827,9 @@ class TestDhcpAgent(base.BaseTestCase):
class TestDhcpAgentEventHandler(base.BaseTestCase): class TestDhcpAgentEventHandler(base.BaseTestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
config.register_interface_driver_opts_helper(cfg.CONF) entry.register_options(cfg.CONF) # register all dhcp cfg options
cfg.CONF.set_override('interface_driver', cfg.CONF.set_override('interface_driver',
'neutron.agent.linux.interface.NullDriver') 'neutron.agent.linux.interface.NullDriver')
entry.register_options(cfg.CONF) # register all dhcp cfg options
self.plugin_p = mock.patch(DHCP_PLUGIN) self.plugin_p = mock.patch(DHCP_PLUGIN)
plugin_cls = self.plugin_p.start() plugin_cls = self.plugin_p.start()

View File

@ -3125,10 +3125,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
self.assertFalse(agent.router_info[router['id']].router['distributed']) self.assertFalse(agent.router_info[router['id']].router['distributed'])
def test_nonexistent_interface_driver(self): def test_nonexistent_interface_driver(self):
self.conf.set_override('interface_driver', None)
self.assertRaises(SystemExit, l3_agent.L3NATAgent,
HOSTNAME, self.conf)
self.conf.set_override('interface_driver', 'wrong.driver') self.conf.set_override('interface_driver', 'wrong.driver')
self.assertRaises(SystemExit, l3_agent.L3NATAgent, self.assertRaises(SystemExit, l3_agent.L3NATAgent,
HOSTNAME, self.conf) HOSTNAME, self.conf)

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The ``[DEFAULT] interface_driver`` option now defaults to ``openvswitch``,
and is not required if the openvswitch mechanism driver or the ovn
mechanism driver is used.