diff --git a/doc/source/admin/config-dvr-ha-snat.rst b/doc/source/admin/config-dvr-ha-snat.rst index 6c28269c3ba..c0a17e73faf 100644 --- a/doc/source/admin/config-dvr-ha-snat.rst +++ b/doc/source/admin/config-dvr-ha-snat.rst @@ -129,7 +129,6 @@ Network nodes [DEFAULT] ha_vrrp_auth_password = password - interface_driver = openvswitch agent_mode = dvr_snat @@ -158,7 +157,6 @@ Compute nodes .. code-block:: ini [DEFAULT] - interface_driver = openvswitch agent_mode = dvr Replace ``TUNNEL_INTERFACE_IP_ADDRESS`` with the IP address of the interface diff --git a/doc/source/admin/deploy-ovs-ha-dvr.rst b/doc/source/admin/deploy-ovs-ha-dvr.rst index 9cdaf3c7eac..95e76ffc5e8 100644 --- a/doc/source/admin/deploy-ovs-ha-dvr.rst +++ b/doc/source/admin/deploy-ovs-ha-dvr.rst @@ -134,7 +134,6 @@ Compute nodes .. code-block:: ini [DEFAULT] - interface_driver = openvswitch agent_mode = dvr #. Restart the following services: diff --git a/doc/source/admin/deploy-ovs-ha-vrrp.rst b/doc/source/admin/deploy-ovs-ha-vrrp.rst index fd9aebe453d..1758a8ca2cc 100644 --- a/doc/source/admin/deploy-ovs-ha-vrrp.rst +++ b/doc/source/admin/deploy-ovs-ha-vrrp.rst @@ -113,13 +113,6 @@ Network node 2 Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the 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: * Open vSwitch agent diff --git a/doc/source/admin/deploy-ovs-provider.rst b/doc/source/admin/deploy-ovs-provider.rst index 577a96ce211..27e8e7a7f43 100644 --- a/doc/source/admin/deploy-ovs-provider.rst +++ b/doc/source/admin/deploy-ovs-provider.rst @@ -184,7 +184,6 @@ Compute nodes .. code-block:: ini [DEFAULT] - interface_driver = openvswitch enable_isolated_metadata = True force_metadata = True diff --git a/doc/source/admin/deploy-ovs-selfservice.rst b/doc/source/admin/deploy-ovs-selfservice.rst index 818374802e4..0f2d533f216 100644 --- a/doc/source/admin/deploy-ovs-selfservice.rst +++ b/doc/source/admin/deploy-ovs-selfservice.rst @@ -143,13 +143,6 @@ Network node Replace ``OVERLAY_INTERFACE_IP_ADDRESS`` with the IP address of the 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: * Open vSwitch agent diff --git a/doc/source/contributor/contribute.rst b/doc/source/contributor/contribute.rst index 8f7f7dd5458..057459e6f84 100644 --- a/doc/source/contributor/contribute.rst +++ b/doc/source/contributor/contribute.rst @@ -535,12 +535,15 @@ Interface (VIF) drivers for the reference implementations are defined in defined in a similar location within their own repo. 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:: - [default] + [DEFAULT] 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.** ``VIF_TYPE_*`` constants in ``neutron_lib/api/definitions/portbindings.py`` should be moved from neutron core to the repositories where their drivers are diff --git a/doc/source/install/controller-install-option1-obs.rst b/doc/source/install/controller-install-option1-obs.rst index f19d20b3378..73366c73032 100644 --- a/doc/source/install/controller-install-option1-obs.rst +++ b/doc/source/install/controller-install-option1-obs.rst @@ -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 actions: - * In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable + isolated metadata so instances on provider networks can access metadata + over the network: .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/doc/source/install/controller-install-option1-rdo.rst b/doc/source/install/controller-install-option1-rdo.rst index 4f22f80d597..7ea98bc5b1b 100644 --- a/doc/source/install/controller-install-option1-rdo.rst +++ b/doc/source/install/controller-install-option1-rdo.rst @@ -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 actions: - * In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable + isolated metadata so instances on provider networks can access metadata + over the network: + .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/doc/source/install/controller-install-option1-ubuntu.rst b/doc/source/install/controller-install-option1-ubuntu.rst index ec7e8a56af1..92266ce2728 100644 --- a/doc/source/install/controller-install-option1-ubuntu.rst +++ b/doc/source/install/controller-install-option1-ubuntu.rst @@ -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 actions: - * In the ``[DEFAULT]`` section, configure the Linux bridge interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver, and enable + isolated metadata so instances on provider networks can access metadata + over the network: .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/doc/source/install/controller-install-option2-obs.rst b/doc/source/install/controller-install-option2-obs.rst index 340690d062e..43275caae80 100644 --- a/doc/source/install/controller-install-option2-obs.rst +++ b/doc/source/install/controller-install-option2-obs.rst @@ -318,19 +318,9 @@ Configure the layer-3 agent The Layer-3 (L3) agent provides routing and NAT services for self-service virtual networks. -* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following - actions: +* Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization + 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 ------------------------ @@ -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 actions: - * In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure the Dnsmasq DHCP driver and enable + isolated metadata so instances on provider networks can access metadata + over the network: .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/doc/source/install/controller-install-option2-rdo.rst b/doc/source/install/controller-install-option2-rdo.rst index 3b4fa652351..c4731b51acf 100644 --- a/doc/source/install/controller-install-option2-rdo.rst +++ b/doc/source/install/controller-install-option2-rdo.rst @@ -320,19 +320,8 @@ Configure the layer-3 agent The Layer-3 (L3) agent provides routing and NAT services for self-service virtual networks. -* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following - actions: - - * In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver: - - .. path /etc/neutron/l3_agent.ini - .. code-block:: ini - - [DEFAULT] - # ... - interface_driver = openvswitch - - .. end +* Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization + is needed. 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 actions: - * In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure Dnsmasq DHCP driver, and enable + isolated metadata so instances on provider networks can access metadata + over the network: .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/doc/source/install/controller-install-option2-ubuntu.rst b/doc/source/install/controller-install-option2-ubuntu.rst index 7646c80fa71..e254c636436 100644 --- a/doc/source/install/controller-install-option2-ubuntu.rst +++ b/doc/source/install/controller-install-option2-ubuntu.rst @@ -321,19 +321,8 @@ Configure the layer-3 agent The Layer-3 (L3) agent provides routing and NAT services for self-service virtual networks. -* Edit the ``/etc/neutron/l3_agent.ini`` file and complete the following - actions: - - * In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver: - - .. path /etc/neutron/l3_agent.ini - .. code-block:: ini - - [DEFAULT] - # ... - interface_driver = openvswitch - - .. end +* Edit the ``/etc/neutron/l3_agent.ini`` file in case additional customization + is needed. 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 actions: - * In the ``[DEFAULT]`` section, configure the Open vSwitch interface driver, - Dnsmasq DHCP driver, and enable isolated metadata so instances on provider - networks can access metadata over the network: + * In the ``[DEFAULT]`` section, configure Dnsmasq DHCP driver, and enable + isolated metadata so instances on provider networks can access metadata + over the network: .. path /etc/neutron/dhcp_agent.ini .. code-block:: ini [DEFAULT] # ... - interface_driver = openvswitch dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true diff --git a/neutron/conf/agent/common.py b/neutron/conf/agent/common.py index b00af8bc7bc..ec2653cc519 100644 --- a/neutron/conf/agent/common.py +++ b/neutron/conf/agent/common.py @@ -95,6 +95,7 @@ AGENT_STATE_OPTS = [ INTERFACE_DRIVER_OPTS = [ cfg.StrOpt('interface_driver', + default='openvswitch', help=_("The driver used to manage virtual interfaces.")), ] @@ -152,16 +153,16 @@ DHCP_PROTOCOL_OPTS = [ ] -def register_external_process_opts(cfg=cfg.CONF): - cfg.register_opts(EXTERNAL_PROCESS_OPTS) +def register_external_process_opts(conf=cfg.CONF): + conf.register_opts(EXTERNAL_PROCESS_OPTS) -def register_interface_opts(cfg=cfg.CONF): - cfg.register_opts(INTERFACE_OPTS) +def register_interface_opts(conf=cfg.CONF): + conf.register_opts(INTERFACE_OPTS) -def register_ra_opts(cfg=cfg.CONF): - cfg.register_opts(RA_OPTS) +def register_ra_opts(conf=cfg.CONF): + conf.register_opts(RA_OPTS) def register_root_helper(conf=cfg.CONF): diff --git a/neutron/tests/fullstack/resources/config.py b/neutron/tests/fullstack/resources/config.py index 58a244dc174..ca8ee80e7aa 100644 --- a/neutron/tests/fullstack/resources/config.py +++ b/neutron/tests/fullstack/resources/config.py @@ -420,8 +420,6 @@ class L3ConfigFixture(ConfigFixture): def _prepare_config_with_ovs_agent(self, integration_bridge): self.config.update({ 'DEFAULT': { - 'interface_driver': ('neutron.agent.linux.interface.' - 'OVSInterfaceDriver'), }, 'OVS': { 'integration_bridge': integration_bridge, @@ -457,7 +455,6 @@ class DhcpConfigFixture(ConfigFixture): def _prepare_config_with_ovs_agent(self, integration_bridge): self.config.update({ 'DEFAULT': { - 'interface_driver': 'openvswitch', }, 'OVS': { 'integration_bridge': integration_bridge, diff --git a/neutron/tests/functional/agent/l2/base.py b/neutron/tests/functional/agent/l2/base.py index e9287813181..4e95e05ca06 100644 --- a/neutron/tests/functional/agent/l2/base.py +++ b/neutron/tests/functional/agent/l2/base.py @@ -146,9 +146,6 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase, OVSOFControllerHelper): def _configure_agent(self): 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('tunnel_bridge', self.br_tun, "OVS") config.set_override('int_peer_patch_port', self.patch_tun, "OVS") diff --git a/neutron/tests/functional/agent/l3/framework.py b/neutron/tests/functional/agent/l3/framework.py index cf0956f8f46..39586486aa2 100644 --- a/neutron/tests/functional/agent/l3/framework.py +++ b/neutron/tests/functional/agent/l3/framework.py @@ -49,8 +49,6 @@ LOG = logging.getLogger(__name__) _uuid = uuidutils.generate_uuid -OVS_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver' - KEEPALIVED_CONFIG = """\ global_defs { notification_email_from %(email_from)s @@ -90,7 +88,6 @@ def get_ovs_bridge(br_name): class L3AgentTestFramework(base.BaseSudoTestCase): - INTERFACE_DRIVER = OVS_INTERFACE_DRIVER NESTED_NAMESPACE_SEPARATOR = '@' def setUp(self): @@ -117,7 +114,6 @@ class L3AgentTestFramework(base.BaseSudoTestCase): def _configure_agent(self, host, agent_mode='dvr_snat'): conf = self._get_config_opts() l3_agent_main.register_opts(conf) - conf.set_override('interface_driver', self.INTERFACE_DRIVER) br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge conf.set_override('integration_bridge', br_int.br_name, 'OVS') diff --git a/neutron/tests/functional/agent/linux/test_dhcp.py b/neutron/tests/functional/agent/linux/test_dhcp.py index ebe289de732..460e2a7438e 100644 --- a/neutron/tests/functional/agent/linux/test_dhcp.py +++ b/neutron/tests/functional/agent/linux/test_dhcp.py @@ -39,7 +39,6 @@ class TestDhcp(functional_base.BaseSudoTestCase): conf.register_opts(common_conf.core_opts) conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS) ovs_conf.register_ovs_opts(conf) - conf.set_override('interface_driver', 'openvswitch') conf.set_override('host', 'foo-host') self.conf = conf br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index c671aa781e9..43d24b7e883 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -62,6 +62,9 @@ class IpLibTestFramework(functional_base.BaseSudoTestCase): def _configure(self): 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( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') diff --git a/neutron/tests/functional/cmd/test_netns_cleanup.py b/neutron/tests/functional/cmd/test_netns_cleanup.py index 5f2730907c8..44e5a382ceb 100644 --- a/neutron/tests/functional/cmd/test_netns_cleanup.py +++ b/neutron/tests/functional/cmd/test_netns_cleanup.py @@ -33,7 +33,6 @@ from neutron.tests.functional import base from neutron.tests.functional.cmd import process_spawn GET_NAMESPACES = 'neutron.agent.linux.ip_lib.list_network_namespaces' -TEST_INTERFACE_DRIVER = 'neutron.agent.linux.interface.OVSInterfaceDriver' NUM_SUBPROCESSES = 6 @@ -52,7 +51,6 @@ class NetnsCleanupTest(base.BaseSudoTestCase): args.append('--force') self.conf = netns_cleanup.setup_conf() - self.conf.set_override('interface_driver', TEST_INTERFACE_DRIVER) self.config_parse(conf=self.conf, args=args) def test_cleanup_network_namespaces_cleans_dhcp_and_l3_namespaces(self): diff --git a/neutron/tests/unit/agent/common/test_utils.py b/neutron/tests/unit/agent/common/test_utils.py index 9214186e06b..419bfd37f38 100644 --- a/neutron/tests/unit/agent/common/test_utils.py +++ b/neutron/tests/unit/agent/common/test_utils.py @@ -34,10 +34,6 @@ class TestLoadInterfaceDriver(base.BaseTestCase): config.register_interface_opts(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): self.conf.set_override('interface_driver', 'neutron.NonExistentDriver') with testlib_api.ExpectedException(SystemExit): @@ -51,6 +47,10 @@ class TestLoadInterfaceDriver(base.BaseTestCase): with testlib_api.ExpectedException(RuntimeError): 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): self.conf.set_override('interface_driver', 'neutron.agent.linux.interface.NullDriver') diff --git a/neutron/tests/unit/agent/dhcp/test_agent.py b/neutron/tests/unit/agent/dhcp/test_agent.py index 023dce58058..491fe76dd0f 100644 --- a/neutron/tests/unit/agent/dhcp/test_agent.py +++ b/neutron/tests/unit/agent/dhcp/test_agent.py @@ -814,11 +814,6 @@ class TestDhcpAgent(base.BaseTestCase): 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): # Temporarily turn off mock, so could use the real import_class # to import interface_driver. @@ -832,10 +827,9 @@ class TestDhcpAgent(base.BaseTestCase): class TestDhcpAgentEventHandler(base.BaseTestCase): def setUp(self): 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', 'neutron.agent.linux.interface.NullDriver') - entry.register_options(cfg.CONF) # register all dhcp cfg options self.plugin_p = mock.patch(DHCP_PLUGIN) plugin_cls = self.plugin_p.start() diff --git a/neutron/tests/unit/agent/l3/test_agent.py b/neutron/tests/unit/agent/l3/test_agent.py index 0906ddf0aa3..f96c559cdb9 100644 --- a/neutron/tests/unit/agent/l3/test_agent.py +++ b/neutron/tests/unit/agent/l3/test_agent.py @@ -3125,10 +3125,6 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework): self.assertFalse(agent.router_info[router['id']].router['distributed']) 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.assertRaises(SystemExit, l3_agent.L3NATAgent, HOSTNAME, self.conf) diff --git a/releasenotes/notes/interface_driver-use-ovs-by-default-53938648662a590b.yaml b/releasenotes/notes/interface_driver-use-ovs-by-default-53938648662a590b.yaml new file mode 100644 index 00000000000..5149f66e84c --- /dev/null +++ b/releasenotes/notes/interface_driver-use-ovs-by-default-53938648662a590b.yaml @@ -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.