[ovs-dev] [PATCH ovn] controller: fix physical flow update for localport
Lorenzo Bianconi
lorenzo.bianconi at redhat.com
Thu May 13 15:33:06 UTC 2021
Properly update logical/openflow flows for localport removing the
interface from the ovs bridge. Openflows in table 65 are not recomputed
removing a localport from an ovs-bridge and the ovs bridge ends-up with
a stale configuration adding the interface back. Fix the issue taking
care of localport special case in physical_handle_ovs_iface_changes
routine.
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
controller/ovn-controller.c | 1 +
controller/physical.c | 6 +++++-
tests/ovn.at | 21 +++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 67c51a86f..8514e35ea 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -1836,6 +1836,7 @@ en_physical_flow_changes_run(struct engine_node *node, void *data)
{
struct ed_type_pfc_data *pfc_tdata = data;
pfc_tdata->recompute_physical_flows = true;
+ pfc_tdata->ovs_ifaces_changed = true;
engine_set_node_state(node, EN_UPDATED);
}
diff --git a/controller/physical.c b/controller/physical.c
index 96c959d18..725959678 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -1874,7 +1874,11 @@ physical_handle_ovs_iface_changes(struct physical_ctx *p_ctx,
const struct sbrec_port_binding *lb_pb =
local_binding_get_primary_pb(p_ctx->local_bindings, iface_id);
if (!lb_pb) {
- continue;
+ lb_pb = lport_lookup_by_name(p_ctx->sbrec_port_binding_by_name,
+ iface_id);
+ if (!lb_pb || strcmp(lb_pb->type, "localport")) {
+ continue;
+ }
}
int64_t ofport = iface_rec->n_ofport ? *iface_rec->ofport : 0;
diff --git a/tests/ovn.at b/tests/ovn.at
index 747967576..06ec60a02 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -11870,6 +11870,27 @@ AT_CHECK([
test 0 -eq $pkts
])
+AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl
+1
+2
+3
+])
+
+# remove the localport from br-int and re-create it
+check ovs-vsctl del-port vif2
+AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl
+1
+3
+])
+
+check ovs-vsctl add-port br-int vif2 \
+ -- set Interface vif2 external-ids:iface-id=lsp
+AT_CHECK([ovs-ofctl dump-flows br-int |awk '/output/{print substr($8, 16, 16)}' |sort], [0], [dnl
+1
+3
+4
+])
+
OVN_CLEANUP([hv1])
AT_CLEANUP
])
--
2.31.1
More information about the dev
mailing list