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'

Signed-off-by: Lorenzo Bianconi <[email protected]>
---
 utilities/ovn-trace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
index e4ea118d0..3c5e0ae1f 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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to