From f6c8ce49551dd8456617fe3aee2c7285ad0d6f6d Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Fri, 6 May 2022 13:58:00 +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. (cherry picked from Neutron 243c209eb2cf75570e6c850b7d5becb468e8d1ab) Partial-bug: #1971431 Signed-off-by: Lucas Alvares Gomes Change-Id: Ic67f6eb408f98f85254ca23a3487b93104db6754 --- networking_ovn/common/constants.py | 4 +++- networking_ovn/common/utils.py | 7 ++++++- networking_ovn/ml2/mech_driver.py | 4 +++- networking_ovn/tests/unit/ml2/test_mech_driver.py | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/networking_ovn/common/constants.py b/networking_ovn/common/constants.py index b2eb1d5d2..a38fd7ed8 100644 --- a/networking_ovn/common/constants.py +++ b/networking_ovn/common/constants.py @@ -297,7 +297,9 @@ HA_CHASSIS_GROUP_HIGHEST_PRIORITY = 32767 EXTERNAL_PORT_TYPES = (portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT_PHYSICAL, - portbindings.VNIC_MACVTAP) + portbindings.VNIC_MACVTAP, + portbindings.VNIC_BAREMETAL, + ) # LB selection fields to represent LB algorithm LB_SELECTION_FIELDS_MAP = { diff --git a/networking_ovn/common/utils.py b/networking_ovn/common/utils.py index a795bde46..8d390b8b3 100644 --- a/networking_ovn/common/utils.py +++ b/networking_ovn/common/utils.py @@ -175,7 +175,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/networking_ovn/ml2/mech_driver.py b/networking_ovn/ml2/mech_driver.py index cb4829f8b..4ea96e81c 100644 --- a/networking_ovn/ml2/mech_driver.py +++ b/networking_ovn/ml2/mech_driver.py @@ -162,7 +162,9 @@ class OVNMechanismDriver(api.MechanismDriver): self.supported_vnic_types = [portbindings.VNIC_NORMAL, portbindings.VNIC_DIRECT, portbindings.VNIC_DIRECT_PHYSICAL, - portbindings.VNIC_MACVTAP] + portbindings.VNIC_MACVTAP, + portbindings.VNIC_BAREMETAL, + ] self.vif_details = { portbindings.VIF_TYPE_OVS: { portbindings.CAP_PORT_FILTER: self.sg_enabled diff --git a/networking_ovn/tests/unit/ml2/test_mech_driver.py b/networking_ovn/tests/unit/ml2/test_mech_driver.py index 77cc7e789..992dfbdf1 100644 --- a/networking_ovn/tests/unit/ml2/test_mech_driver.py +++ b/networking_ovn/tests/unit/ml2/test_mech_driver.py @@ -3309,6 +3309,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')