[ovs-dev] [PATCH ovn] pinctrl: Handle service monitors even if the lport doesn't have IPv4 addresses set.

numans at ovn.org numans at ovn.org
Fri Apr 17 06:50:22 UTC 2020


From: Numan Siddique <numans at ovn.org>

If a logical port is only configured with MAC address(es) in the
Logical_Switch_Port.addresses, pinctrl is ignoring the service monitors
configured for that logical port. This patch allows that.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1801058
Signed-off-by: Numan Siddique <numans at ovn.org>
---
 controller/pinctrl.c |  5 +++++
 tests/ovn.at         | 31 +++++++++++++++++++++++++++++++
 tests/system-ovn.at  |  4 ++--
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/controller/pinctrl.c b/controller/pinctrl.c
index a053938ec..8703641c2 100644
--- a/controller/pinctrl.c
+++ b/controller/pinctrl.c
@@ -5786,6 +5786,11 @@ sync_svc_monitors(struct ovsdb_idl_txn *ovnsb_idl_txn,
 
             if (mac_found) {
                 break;
+            } else if (!laddrs.n_ipv4_addrs) {
+                /* IPv4 address(es) are not configured. Use the first mac. */
+                ea = laddrs.ea;
+                mac_found = true;
+                break;
             }
         }
 
diff --git a/tests/ovn.at b/tests/ovn.at
index f83d3f536..7858c496e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -17947,6 +17947,37 @@ AT_CHECK([cat lflows.txt], [0], [dnl
   table=6 (lr_in_dnat         ), priority=120  , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(drop;)
 ])
 
+# Delete sw0-p1
+ovn-nbctl lsp-del sw0-p1
+
+OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl --bare --columns _uuid find \
+service_monitor | sed '/^$/d' | wc -l)])
+
+# Add back sw0-p1 but without any IP address.
+ovn-nbctl lsp-add sw0 sw0-p1
+ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03" -- \
+lsp-set-port-security sw0-p1 "50:54:00:00:00:03"
+
+OVS_WAIT_UNTIL([test 2 = $(ovn-sbctl --bare --columns status find \
+service_monitor | grep offline | wc -l)])
+
+ovn-nbctl lsp-del sw0-p1
+ovn-nbctl lsp-del sw1-p1
+OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns _uuid find \
+service_monitor | sed '/^$/d' | wc -l)])
+
+# Add back sw0-p1 but without any address set.
+ovn-nbctl lsp-add sw0 sw0-p1
+
+OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl --bare --columns _uuid find \
+service_monitor | sed '/^$/d' | wc -l)])
+
+OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns status find \
+service_monitor | grep offline | wc -l)])
+
+OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns status find \
+service_monitor | grep online | wc -l)])
+
 OVN_CLEANUP([hv1], [hv2])
 AT_CLEANUP
 
diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index 000b3f13b..bdb9768d2 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -3356,8 +3356,8 @@ start_daemon ovn-controller
 ovn-nbctl ls-add sw0
 
 ovn-nbctl lsp-add sw0 sw0-p1
-ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3"
-ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03 10.0.0.3"
+ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03"
+ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03"
 
 ovn-nbctl lsp-add sw0 sw0-p2
 ovn-nbctl lsp-set-addresses sw0-p2 "50:54:00:00:00:04 10.0.0.4"
-- 
2.25.1



More information about the dev mailing list