From e7df43395c60c700c25171d131255ae5ae0b716d Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Mon, 13 Jul 2020 11:44:47 +0100 Subject: [PATCH] [OVN] DevStack: Make the transition of DevStack module easier This patch intends to make the transition of the OVN DevStack module easier by allowing both copies of it to exist at the same time, the one in Neutron repository and the one in the DevStack repository [0]. 1) Make create_public_bridge idempotent If we call this function more than once the second call and on will fail with the following error: 2020-07-13 09:12:53.885633 | controller | ++ /opt/stack/neutron/devstack/lib/ovn_agent:create_public_bridge:263 : sudo ip addr add 172.24.5.1/24 dev br-ex 2020-07-13 09:12:53.894247 | controller | RTNETLINK answers: File exists During the transiton of moving the OVN DevStack from the Neutron repository to the DevStack repository [0] this method is being invoked twice in the ovn job in the DevStack gate because it will be cause as part of the plugin being enabled and the normal code execution. This patch makes the method idempotent by calling "addr replace" instead of "addr add" to avoid the "RTNETLINK answers: File exists" error. 2) Move the setup of the tcpdump on br-ex to "extra" to it can start after the create_public_bridge is called. [0] https://review.opendev.org/#/c/734621/ Change-Id: I74b05ef245a343c7531fa45aeadb90060b2fd22e Signed-off-by: Lucas Alvares Gomes --- devstack/lib/ovn_agent | 4 ++-- devstack/plugin.sh | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/devstack/lib/ovn_agent b/devstack/lib/ovn_agent index db488634950..e44112f6fc5 100644 --- a/devstack/lib/ovn_agent +++ b/devstack/lib/ovn_agent @@ -260,7 +260,7 @@ function create_public_bridge { ovs-vsctl set open . external-ids:ovn-bridge-mappings=$PHYSICAL_NETWORK:$ext_gw_ifc if [ -n "$FLOATING_RANGE" ]; then local cidr_len=${FLOATING_RANGE#*/} - sudo ip addr add $PUBLIC_NETWORK_GATEWAY/$cidr_len dev $ext_gw_ifc + sudo ip addr replace $PUBLIC_NETWORK_GATEWAY/$cidr_len dev $ext_gw_ifc fi # Ensure IPv6 RAs are accepted on the interface with the default route. @@ -274,7 +274,7 @@ function create_public_bridge { sudo sysctl -w net.ipv6.conf.all.forwarding=1 if [ -n "$IPV6_PUBLIC_RANGE" ]; then local ipv6_cidr_len=${IPV6_PUBLIC_RANGE#*/} - sudo ip -6 addr add $IPV6_PUBLIC_NETWORK_GATEWAY/$ipv6_cidr_len dev $ext_gw_ifc + sudo ip -6 addr replace $IPV6_PUBLIC_NETWORK_GATEWAY/$ipv6_cidr_len dev $ext_gw_ifc # NOTE(numans): Commenting the below code for now as this is breaking # the CI after xenial upgrade. # https://bugs.launchpad.net/networking-ovn/+bug/1648670 diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 7bd1ea52aed..71dd93b6ee2 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -116,15 +116,6 @@ if [[ "$1" == "stack" ]]; then configure_ovn_plugin start_ovn fi - if is_service_enabled br-ex-tcpdump ; then - # tcpdump monitor on br-ex for ARP, reverse ARP and ICMP v4 / v6 packets - sudo ip link set dev $PUBLIC_BRIDGE up - run_process br-ex-tcpdump "/usr/sbin/tcpdump -i $PUBLIC_BRIDGE arp or rarp or icmp or icmp6 -enlX" "$STACK_GROUP" root - fi - - if is_service_enabled br-int-flows ; then - run_process br-int-flows "/bin/sh -c \"set +e; while true; do echo ovs-ofctl dump-flows br-int; ovs-ofctl dump-flows br-int ; sleep 30; done; \"" "$STACK_GROUP" root - fi ;; extra) if is_service_enabled q-sriov-agt neutron-sriov-agent; then @@ -141,6 +132,15 @@ if [[ "$1" == "stack" ]]; then fi fi fi + if is_service_enabled br-ex-tcpdump ; then + # tcpdump monitor on br-ex for ARP, reverse ARP and ICMP v4 / v6 packets + sudo ip link set dev $PUBLIC_BRIDGE up + run_process br-ex-tcpdump "/usr/sbin/tcpdump -i $PUBLIC_BRIDGE arp or rarp or icmp or icmp6 -enlX" "$STACK_GROUP" root + fi + + if is_service_enabled br-int-flows ; then + run_process br-int-flows "/bin/sh -c \"set +e; while true; do echo ovs-ofctl dump-flows br-int; ovs-ofctl dump-flows br-int ; sleep 30; done; \"" "$STACK_GROUP" root + fi ;; esac elif [[ "$1" == "unstack" ]]; then