[ovs-dev] [PATCH v2 ovn] ovn-trace: fix trigger_event warning

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Tue Jan 5 14:37:37 UTC 2021


Fix the following ovn-trace warning triggered by controller_event:

00001|ovntrace|WARN|trigger_event(event = "empty_lb_backends", meter = "",
				  vip = "192.168.0.100:80", protocol = "tcp",
				  load_balancer = "2c5462a7-b6ca-4b02-86c9-b9aa98a570e8");
parsing actions failed (Syntax error a t `vip' expecting empty_lb_backends option name.)

The issue can be triggered running the following reproducer in ovn-sanbox:

$./ovn-setup.sh
$ovn-nbctl lb-add lb0 192.168.0.100:80 ""
$ovn-nbctl ls-lb-add sw0 lb0
$ovn-nbctl --wait=hv set NB_Global . options:controller_event=true
$ovn-trace sw0 'inport == "sw0-port1" && eth.src == 50:54:00:00:00:01 && ip4.src==192.168.0.2 && eth.dst == 00:00:00:00:ff:01 && ip4.dst==192.168.0.100 && tcp && tcp.dst==80'

Acked-by: Dumitru Ceara <dceara at redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
Changes since v1:
- add unitests
---
 tests/ovn.at          | 2 ++
 utilities/ovn-trace.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/tests/ovn.at b/tests/ovn.at
index a5bf9bf85..921c5f852 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -16895,6 +16895,8 @@ AT_CHECK_UNQUOTED([ovn-sbctl get controller_event $uuid event_info:load_balancer
 "$uuid_lb2"
 ])
 
+AT_CHECK_UNQUOTED([ovn-trace sw0 'inport == "sw0-p11" && eth.src == 00:00:00:00:00:11 && ip4.dst == 192.168.1.100 && tcp && tcp.dst == 80' | grep -q 'event = "empty_lb_backends"'], [0])
+
 OVN_CLEANUP([hv1], [hv2])
 AT_CLEANUP
 
diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
index fb66f6434..2fe704785 100644
--- a/utilities/ovn-trace.c
+++ b/utilities/ovn-trace.c
@@ -478,6 +478,7 @@ static struct shash port_groups;
 static struct hmap dhcp_opts;   /* Contains "struct gen_opts_map"s. */
 static struct hmap dhcpv6_opts; /* Contains "struct gen_opts_map"s. */
 static struct hmap nd_ra_opts; /* Contains "struct gen_opts_map"s. */
+static struct controller_event_options event_opts;
 
 static struct ovntrace_datapath *
 ovntrace_datapath_find_by_sb_uuid(const struct uuid *sb_uuid)
@@ -901,6 +902,7 @@ parse_lflow_for_datapath(const struct sbrec_logical_flow *sblf,
             .dhcp_opts = &dhcp_opts,
             .dhcpv6_opts = &dhcpv6_opts,
             .nd_ra_opts = &nd_ra_opts,
+            .controller_event_opts = &event_opts,
             .pipeline = (!strcmp(sblf->pipeline, "ingress")
                          ? OVNACT_P_INGRESS
                          : OVNACT_P_EGRESS),
@@ -1006,6 +1008,8 @@ read_gen_opts(void)
 
     hmap_init(&nd_ra_opts);
     nd_ra_opts_init(&nd_ra_opts);
+
+    controller_event_opts_init(&event_opts);
 }
 
 static void
-- 
2.29.2



More information about the dev mailing list