From 2e1ba361577e59ca6f8a8227e75c3b2195ce4f93 Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Fri, 30 Apr 2021 09:42:17 +0100 Subject: [PATCH] [OVN] Add baremetal support with Neutron DHCP agent This patch now creates OVN "external" ports for Neutron ports with VNIC_BAREMETAL. This ports will be scheduled on the OpenStack Controller nodes (or OVN Gateway nodes) and are responsible for replying to the ARP requests coming from the baremetal nodes. This patch also disables OVN's built-in DHCP server for VNIC_BAREMETAL ports. This is because OVN DHCP server does not yet fully support chainloading from PXE to iPXE, this feature is work-in-progress right now. A following patch to this one will be sent in the future adding support for OVN's built-in DHCP server being used with baremetal nodes. This patch implements the "Part 1" from bug #1971431. Conflicts: neutron/common/ovn/constants.py neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py Partial-bug: #1971431 Change-Id: I6b234fbe1b7c54b41a1b8b430fdf0ac76993af96 Signed-off-by: Lucas Alvares Gomes (cherry picked from commit 243c209eb2cf75570e6c850b7d5becb468e8d1ab) --- neutron/common/ovn/constants.py | 4 +++- neutron/common/ovn/utils.py | 7 ++++++- neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py | 1 + .../ml2/drivers/ovn/mech_driver/test_mech_driver.py | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/neutron/common/ovn/constants.py b/neutron/common/ovn/constants.py index c7b5726a22d..9cc5dfaef89 100644 --- a/neutron/common/ovn/constants.py +++ b/neutron/common/ovn/constants.py @@ -299,7 +299,9 @@ MCAST_FLOOD_UNREGISTERED = 'mcast_flood_unregistered' EXTERNAL_PORT_TYPES = (portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT_PHYSICAL, - portbindings.VNIC_MACVTAP) + portbindings.VNIC_MACVTAP, + portbindings.VNIC_BAREMETAL, + ) NEUTRON_AVAILABILITY_ZONES = 'neutron-availability-zones' OVN_CMS_OPTIONS = 'ovn-cms-options' diff --git a/neutron/common/ovn/utils.py b/neutron/common/ovn/utils.py index cb2f5308057..29dafd92562 100644 --- a/neutron/common/ovn/utils.py +++ b/neutron/common/ovn/utils.py @@ -168,7 +168,12 @@ def get_lsp_dhcp_opts(port, ip_version): # in OVN. lsp_dhcp_disabled = False lsp_dhcp_opts = {} - if is_network_device_port(port): + vnic_type = port.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL) + + # NOTE(lucasagomes): Baremetal does not yet work with OVN's built-in + # DHCP server, disable it for now + if (is_network_device_port(port) or + vnic_type == portbindings.VNIC_BAREMETAL): lsp_dhcp_disabled = True else: mapping = constants.SUPPORTED_DHCP_OPTS_MAPPING[ip_version] diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py index 0fec2668cbc..a2c7e1fa6ef 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/mech_driver.py @@ -189,6 +189,7 @@ class OVNMechanismDriver(api.MechanismDriver): portbindings.VNIC_DIRECT_PHYSICAL, portbindings.VNIC_MACVTAP, portbindings.VNIC_VHOST_VDPA, + portbindings.VNIC_BAREMETAL, ] self.vif_details = { portbindings.VIF_TYPE_OVS: { diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index 17675cf0001..b799183403d 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -3427,6 +3427,10 @@ class TestOVNMechanismDriverSecurityGroup( self._test_create_port_with_vnic_type( portbindings.VNIC_MACVTAP) + def test_create_port_with_vnic_baremetal(self): + self._test_create_port_with_vnic_type( + portbindings.VNIC_BAREMETAL) + def test_update_port_with_sgs(self): with self.network() as n, self.subnet(n): sg1 = self._create_empty_sg('sg1')