From patchwork Fri Mar 26 17:15:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 1458892 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=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LIejZAIN; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F6TC76494z9sS8 for ; Sat, 27 Mar 2021 04:16:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DD7B24186E; Fri, 26 Mar 2021 17:16:01 +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 1STNLaaL-MwC; Fri, 26 Mar 2021 17:16:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTP id D9D4541869; Fri, 26 Mar 2021 17:15:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B4435C000E; Fri, 26 Mar 2021 17:15:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 653B6C000A for ; Fri, 26 Mar 2021 17:15:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 544EA84C95 for ; Fri, 26 Mar 2021 17:15:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7krnMd044O2G for ; Fri, 26 Mar 2021 17:15:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 65CAE84C85 for ; Fri, 26 Mar 2021 17:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616778956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Izoy+0WpAZqE/n7ydSfo5jSX9fdWZfWYw0BB/kFyQi0=; b=LIejZAIN1jX3CyObV1HB90XSgxZZnZoYi9g2QyDXZJbYWxvd7qm8+rfcKguE6gD4l78KHm JLU0eTNspKq/MBzgH/IjsIIa6SahhUnwsXZCYWEV2zRzs7rOMUdl8I7wP8pWinjvUwRFI+ NfB743y83o7l/kOi4jAUTXj2cFE3V18= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-106-5oMYZmLDPHijD4TVIUqlsg-1; Fri, 26 Mar 2021 13:15:54 -0400 X-MC-Unique: 5oMYZmLDPHijD4TVIUqlsg-1 Received: by mail-wr1-f71.google.com with SMTP id e9so3973778wrg.6 for ; Fri, 26 Mar 2021 10:15:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Izoy+0WpAZqE/n7ydSfo5jSX9fdWZfWYw0BB/kFyQi0=; b=b44ZMdxXKMyvvFrDFtEThjxNt+lDX+8RrZGf81pTXeRw2ra18jdD7jw4p+d3ODhCT7 TN42eAQivb4OEC1qPEkLGEicTR8upIuHkN3CIT0btfzmiSWYgFiSEmHOOWa+fKoxsDCp ak8uOjGOps5NhBuudz3mtlZIxSggBDV6lw66CRyMNxJpdbT7DdLcG2ySPClKfHfbMY6h F/cZQ30XBd/RksIPo9ZNSHg/8ikaX2jpXP+/KTc1ssvr51UP/50mxeC8vTV7EBWG3hGX s+C/He6AWPDk2VEaoDEOVet9lk/muOlAJSLsG064Bvn19P9zl58GPEC1TxIvWlHEX9GH ByVg== X-Gm-Message-State: AOAM531AAgp5858BC6Kea1zKJwceIGuXPd3ltRhFjKZBIeMD38r4Hb1/ QyBKEN1nflgkYAVPKNp/JzeCKBgwDEgHITTVHbIeSiHhxjLc7zqKe4nQOJuXjHA69oBkKXOacFn TjwaorYKmeBmXmHHl7nz99zWws4cCY2x/IjrKM2rdLXDaplXMpmJz1Ic8qdD6wIJgqQtAtLMkA5 M= X-Received: by 2002:a05:600c:4f94:: with SMTP id n20mr13879377wmq.18.1616778952749; Fri, 26 Mar 2021 10:15:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9CKwE6kTevv1Idj9p3EkhAgrHLZHl/EVXSysLWpT8a2P0izRxmjBTiY5IuBHK2EEZNw4iyg== X-Received: by 2002:a05:600c:4f94:: with SMTP id n20mr13879360wmq.18.1616778952471; Fri, 26 Mar 2021 10:15:52 -0700 (PDT) Received: from lore-desk.redhat.com ([151.66.54.126]) by smtp.gmail.com with ESMTPSA id c2sm11244948wme.15.2021.03.26.10.15.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 10:15:52 -0700 (PDT) From: Lorenzo Bianconi To: dev@openvswitch.org Date: Fri, 26 Mar 2021 18:15:40 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: jishi@redhat.com Subject: [ovs-dev] [PATCH v2 ovn] controller: do not claim localports 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" Localports should not be binded to any specific controller but should be available to each hv however in the current codebase consider_iface_claim routine is claiming the localport for a specific chassis. Fix the issue skipping localports in consider_iface_claim routine. https://bugzilla.redhat.com/show_bug.cgi?id=1937662 Reviewed-by: Mark D. Gray Signed-off-by: Lorenzo Bianconi Acked-by: Mark Michelson Acked-by: Mark D. Gray --- Changes since v1: - move lport_lookup before local_binding_find - fix commit message --- controller/binding.c | 10 ++++++++-- tests/ovn.at | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 4e6c75696..7bb26f819 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -1799,6 +1799,13 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, update_local_lports(iface_id, b_ctx_out); smap_replace(b_ctx_out->local_iface_ids, iface_rec->name, iface_id); + const struct sbrec_port_binding *pb = + lport_lookup_by_name(b_ctx_in->sbrec_port_binding_by_name, iface_id); + if (pb && get_lport_type(pb) == LP_LOCALPORT) { + /* nothing to do for localports. */ + return true; + } + struct local_binding *lbinding = local_binding_find(b_ctx_out->local_bindings, iface_id); @@ -1810,8 +1817,7 @@ consider_iface_claim(const struct ovsrec_interface *iface_rec, } if (!lbinding->pb || strcmp(lbinding->name, lbinding->pb->logical_port)) { - lbinding->pb = lport_lookup_by_name( - b_ctx_in->sbrec_port_binding_by_name, lbinding->name); + lbinding->pb = pb; if (lbinding->pb && !strcmp(lbinding->pb->type, "virtual")) { lbinding->pb = NULL; } diff --git a/tests/ovn.at b/tests/ovn.at index 391a8bcd9..d36e2483f 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -11567,6 +11567,9 @@ test_packet() { fi } +# Check the localport is not claimed by the hvs +chassis_lp=$(fetch_column port_binding chassis logical_port=lp01) +AT_CHECK([$(fetch_column port_binding chassis logical_port=lp01)], [0]) # lp11 and lp21 are on different hypervisors test_packet 11 f0:00:00:00:00:21 f0:00:00:00:00:11 1121 lp21 lp21