The external_ids:encap-ip was supported to optionally specify encap IP
for a logical switch port. However, when the external_ids:encap-ip is
unset, the implementation didn't clear the column in Port_Binding. This
patch fixes it and updated the test to cover this scenario.

Fixes: dd527a283cd8 ("Support for multiple VTEP in OVN")
Cc: Venugopal Iyer <[email protected]>
Signed-off-by: Han Zhou <[email protected]>
---
 controller/binding.c | 3 ++-
 tests/ovn.at         | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/controller/binding.c b/controller/binding.c
index 7281b0485..e284704d8 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -960,7 +960,8 @@ claim_lport(const struct sbrec_port_binding *pb,
     /* Check if the port encap binding, if any, has changed */
     struct sbrec_encap *encap_rec =
         sbrec_get_port_encap(chassis_rec, iface_rec);
-    if (encap_rec && pb->encap != encap_rec) {
+    if ((encap_rec && pb->encap != encap_rec) ||
+        (!encap_rec && pb->encap)) {
         if (sb_readonly) {
             return false;
         }
diff --git a/tests/ovn.at b/tests/ovn.at
index 34b6abfc0..799a6aabd 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -2462,6 +2462,15 @@ encap_rec=$(fetch_column Encap _uuid chassis_name=hv2 
type=geneve ip=192.168.0.2
 check_row_count Port_Binding 1 logical_port=lp21 encap=$encap_rec
 check_row_count Port_Binding 1 logical_port=lp22 encap=$encap_rec
 
+# Remove the encap-ip setting in vif, which should trigger encap removal from
+# Port_Binding.
+as hv1 ovs-vsctl remove Interface vif11 external-ids encap-ip
+wait_row_count Port_Binding 1 logical_port=lp11 'encap=[[]]'
+
+# Change it back and continue the test
+as hv1 ovs-vsctl set Interface vif11 external-ids:encap-ip=192.168.0.1
+wait_row_count Port_Binding 1 logical_port=lp11 'encap!=[[]]'
+
 # Pre-populate the hypervisors' ARP tables so that we don't lose any
 # packets for ARP resolution (native tunneling doesn't queue packets
 # for ARP resolution).
-- 
2.30.2

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

Reply via email to