From 19fc17eee44cb899e62292a8f6ff4cfe98815ea6 Mon Sep 17 00:00:00 2001
Message-Id: <19fc17eee44cb899e62292a8f6ff4cfe98815ea6.1610114400.git.lorenzo.bianconi@redhat.com>
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
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 <dceara@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
tests/ovn.at | 2 ++
utilities/ovn-trace.c | 4 ++++
2 files changed, 6 insertions(+)
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -16889,6 +16889,8 @@ AT_CHECK_UNQUOTED([ovn-sbctl get control
"$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
--- 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 sb
.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