From patchwork Tue May 3 18:36:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1625699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Kt7vx0ZWPz9sGg for ; Wed, 4 May 2022 04:36:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4D8B4417B7; Tue, 3 May 2022 18:36:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kO5w8ZGpp6pZ; Tue, 3 May 2022 18:36:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2994041706; Tue, 3 May 2022 18:36:22 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EB82FC0032; Tue, 3 May 2022 18:36:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id D567EC002D for ; Tue, 3 May 2022 18:36:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C30DC417AB for ; Tue, 3 May 2022 18:36:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iKz8Wwn9k9-5 for ; Tue, 3 May 2022 18:36:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8B03041706 for ; Tue, 3 May 2022 18:36:19 +0000 (UTC) Received: (Authenticated sender: hzhou@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id B28F66000C; Tue, 3 May 2022 18:36:15 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Tue, 3 May 2022 11:36:06 -0700 Message-Id: <20220503183606.275210-1-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Cc: Venugopal Iyer Subject: [ovs-dev] [PATCH ovn] binding.c: Clear Port_Binding's encap column when encap-ip is removed. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 Signed-off-by: Han Zhou --- 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).