[ovs-agent] Removes IPv4 check from IPv6 detection

[1] improved the IPv6 detection procedure used by Neutron Open vSwitch
(OVS) agent in the initialization script. The new procedure was based
both on IPv4 interfaces check (ip -4 addr show) and  IPv6 interface
check (ip -6 addr show ).

As described in the test plan included in [1], the IPv6 detection
improvements were only validated and worked on virtual environemts (vbox
deployments). However, when OVS is deployed on IPv6 networks but the
underlying platform uses IPv4 interfaces for any other purpose (e.g.,
PXE boot), the new IPv6 detection procedure would erroneously consider
it an IPv4 deployment.

This change removes IPv4 interfaces check (ip -4 addr show) from the
IPv6 detection procedure, keeping it based only on IPv6 interface check
(ip -6 addr show ) and so fixing it for IPv6 deployments in which the
underlying platform uses IPv4 interfaces for secondary purposes (e.g.,
PXE boot).

[1] https://review.opendev.org/c/starlingx/openstack-armada-app/+/955605

Test Plan:
[PASS] Build all the stx-openstack packages
[PASS] Build stx-openstack tarball

IPV6 Deployment + IPv4 PXE boot network (AIO-SX):
[PASS] Upload and apply stx-openstack
[PASS] neutron-ovs-agent successfully deployed

IPV4 Deployment (virtualbox AIO-SX):
[PASS] Upload and apply stx-openstack
[PASS] neutron-ovs-agent successfully deployed

Closes-Bug: #2117275

Change-Id: I0b1a43ca05dd4b2cda90039c13c436fdaf78c801
Signed-off-by: Alex Figueiredo <alex.fernandesfigueiredo@windriver.com>
This commit is contained in:
Alex Figueiredo
2025-08-07 10:53:17 -03:00
parent c61b4736c3
commit e1e914a4ac

View File

@@ -16,6 +16,18 @@ Signed-off-by: Ingo Almendros Girao <ingo.almendrosgirao@windriver.com>
Added a verification of cidr before get the tunnel interface
Signed-off-by: Ingo Almendros Girao <ingo.almendrosgirao@windriver.com>
[ Removes IPv4 interfaces check from IPv6 detection]
The platform's network interfaces are visible from ovs-agent container.
Therefore, when OVS is deployed on IPv6 networks but the underlying platform
uses IPv4 interfaces for any other purpose (e.g., PXE boot), the previous
script would erroneously consider it an IPv4 deployment.
This fix removes IPv4 interfaces check (ip -4 addr show) from the IPv6 detection
procedure, keeping it based only on IPv6 interface check (ip -6 addr show ).
Signed-off-by: Alex Figueiredo <alex.fernandesfigueiredo@windriver.com>
---
.../_neutron-openvswitch-agent-init.sh.tpl | 60 ++++++++++++++++++-
1 file changed, 57 insertions(+), 3 deletions(-)
@@ -42,7 +54,7 @@ index bd0a64ac8..b9caf8916 100644
+ local cidr="$1"
+
+ if [[ "$cidr" == "0/0" ]]; then
+ if ip -6 addr show | grep -q "inet6.*scope global" && ! ip -4 addr show | grep -q "inet.*scope global"; then
+ if ip -6 addr show | grep -q "inet6.*scope global"; then
+ cidr="::/0"
+ fi
+ fi
@@ -95,7 +107,7 @@ index bd0a64ac8..b9caf8916 100644
- LOCAL_IP=$(get_ip_address_from_interface ${tunnel_interface})
+ tunnel_network_cidr_corrected="${tunnel_network_cidr}"
+ if [[ "${tunnel_network_cidr}" == "0/0" ]]; then
+ if ip -6 addr show | grep -q "inet6.*scope global" && ! ip -4 addr show | grep -q "inet.*scope global"; then
+ if ip -6 addr show | grep -q "inet6.*scope global"; then
+ tunnel_network_cidr_corrected="::/0"
+ fi
+ fi