From 847589adf8d31d7e9d735696f9e01a418f8b2cbe Mon Sep 17 00:00:00 2001 From: Lorenzo Bianconi Date: Tue, 5 Jan 2021 15:37:37 +0100 Subject: [PATCH] ovn-trace: fix trigger_event warning. 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 Signed-off-by: Lorenzo Bianconi Signed-off-by: Numan Siddique (cherry-picked from master commit f35e33228f6fec97bbecc1f01e28e366d826b585) --- 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 7fc23da2ad..4bfe8ba0d1 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -15481,6 +15481,8 @@ AT_CHECK([ovn-sbctl get controller_event $uuid event_info:vip], [0], [dnl "192.168.2.100:80" ]) +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 5e1d92c720..dc3678ebce 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -476,6 +476,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) @@ -902,6 +903,7 @@ read_flows(void) .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), @@ -981,6 +983,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