diff mbox series

[ovs-dev] binding.c: Clear Port_Binding's encap column when encap-ip is removed.

Message ID 20220503183606.275210-1-hzhou@ovn.org
State Accepted
Headers show
Series [ovs-dev] binding.c: Clear Port_Binding's encap column when encap-ip is removed. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Han Zhou May 3, 2022, 6:36 p.m. UTC
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 <venugopali@nvidia.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
---
 controller/binding.c | 3 ++-
 tests/ovn.at         | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Venugopal Iyer May 4, 2022, 4:05 p.m. UTC | #1
Changes look good to me Han.

thanks!

-venu
Han Zhou May 6, 2022, 5:19 a.m. UTC | #2
On Wed, May 4, 2022 at 9:05 AM Venugopal Iyer <venugopali@nvidia.com> wrote:
>
> Changes look good to me Han.
>
> thanks!
>
> -venu
>
Thanks Venu. I merged to main and backported to branch-22.03.

Han
diff mbox series

Patch

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).