From patchwork Fri Sep 29 15:05:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 820000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y3ZdC08v8z9t5P for ; Sat, 30 Sep 2017 01:06:07 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7F3A7AC8; Fri, 29 Sep 2017 15:05:32 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E1F95A92 for ; Fri, 29 Sep 2017 15:05:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 68056157 for ; Fri, 29 Sep 2017 15:05:29 +0000 (UTC) Received: by mail-wr0-f177.google.com with SMTP id h16so2491427wrf.6 for ; Fri, 29 Sep 2017 08:05:29 -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:subject:date:message-id:in-reply-to :references; bh=dbOPgfa3TU3luysiwJU2CVbejWjVz7hR95mfNe8SJ9w=; b=H1HBknhPPYjvzJFftYp96WNkJQ0pnCQJ9KQmC2fN509llev/RadEP2MiSPe1uMecek SkXPjn+KAGUIdQqZIhIE4OKvbiHZMUd9OxN/obTwA/7JDdOBBkENjIYiQ+Z0NXjdedBz gxY7EkLgt9TMQviKgVOQ5Ie7UJFi/E4v4kKkHL+FLzgxcGOjvRh5ujZEL29b0wA7Z+QE SC4wp/Rb+VOJ7MzDDzghlGi03vUvnyUsyNdedsNgBYmwwpJnUZ3FA2v8PhbyxVIOKSJt UEltFz0H/D6aZXdoOpKBx/2Cj2b25AxCcji68kQ5ryUqbABH43Z+CjqWRPCXxTfzz382 D1yA== X-Gm-Message-State: AHPjjUjSOYk/QHfAyvqQX8vh7ZhEAmQIcgfa92qpofhlG7/ss7CKjcDQ Bh2S8mESZwM3EDjOWIaQNY/IYBJXg8g= X-Google-Smtp-Source: AOwi7QAVvacF1BJbuxuBjYb4sEh1567WinnJpTq8rbDDW6KLlMyDkBsD/AZo/b+LgNayiudUdEZxKA== X-Received: by 10.223.150.194 with SMTP id u60mr7638698wrb.243.1506697527704; Fri, 29 Sep 2017 08:05:27 -0700 (PDT) Received: from redhat.com (red-hat-inc.vlan404.asr1.mad1.gblx.net. [64.215.113.190]) by smtp.gmail.com with ESMTPSA id w62sm2064944wmb.32.2017.09.29.08.05.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Sep 2017 08:05:26 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Fri, 29 Sep 2017 17:05:22 +0200 Message-Id: <20170929150523.8833-2-jkbs@redhat.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170929150523.8833-1-jkbs@redhat.com> References: <20170929150523.8833-1-jkbs@redhat.com> X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 1/2] ovn-northd: Refactor logic for logical port 'up' state update X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org No functional change. Make it obvious that we determine the logical port 'up' state by checking for bound chassis, and update the NB DB only when state has not been set yet or current state is different. Signed-off-by: Jakub Sitnicki Acked-by: Mark Michelson Acked-by: Miguel Angel Ajo --- ovn/northd/ovn-northd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 2db2380..37651a0 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -5980,11 +5980,8 @@ update_logical_port_status(struct northd_context *ctx) continue; } - if (sb->chassis && (!nbsp->up || !*nbsp->up)) { - bool up = true; - nbrec_logical_switch_port_set_up(nbsp, &up, 1); - } else if (!sb->chassis && (!nbsp->up || *nbsp->up)) { - bool up = false; + bool up = sb->chassis ? true : false; + if (!nbsp->up || *nbsp->up != up) { nbrec_logical_switch_port_set_up(nbsp, &up, 1); } } From patchwork Fri Sep 29 15:05:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 820001 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y3Zdq5qBGz9t4k for ; Sat, 30 Sep 2017 01:06:39 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 71DEBACB; Fri, 29 Sep 2017 15:05:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5EC409C0 for ; Fri, 29 Sep 2017 15:05:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8D55DFC for ; Fri, 29 Sep 2017 15:05:31 +0000 (UTC) Received: by mail-wr0-f175.google.com with SMTP id 54so2481783wrz.10 for ; Fri, 29 Sep 2017 08:05:31 -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:subject:date:message-id:in-reply-to :references; bh=eBgTUj2rx16CN4U2aDu1vruBMsz06eKHM+P6f4n5HV4=; b=TCN+qI0fI276q7chpo0TmGM6GZjuCmpRZvQ2eDmzNsxZhlMTC/3SRFHUNlwU9oNrI0 61DIcfLv1s1tprZrNxKaXaOKv+n9Aif/ha+7i0Y5ki6x4p39KqgssYhAn20kWzu7wLhr GCIYqeYPFYa6limw9BZfIizIyLNgwbxG8IHKpDJyNfhJRj4TtlyWajnDsO84J3UNjNPH jyNFjNs6WMSP5qjIH4WMxv9z8bb0KIXQyIxACg7ZzsIbQ9v3KNNgKTHDmlDSwWOV1R1t QieOR6J8TbwySZUguJi92h1dTB8PFrvmhemBqSEKqHgY1yxe1/mBuBGVOdI44IaUCU5h 5f2w== X-Gm-Message-State: AHPjjUj+FFm215pweVEu/3KzKO547BRYXzspdbRjVXyu8mEgKYY0BE9G 8wX7KYzTab7ENwQUMs5c3ujyEDB7Rzk= X-Google-Smtp-Source: AOwi7QBouS532roXKFhNIleNcp1myHbIZ3XzUtGoceO264HWaG6ddxQa2khI0Oo+gq4Wc6lnfOKhow== X-Received: by 10.223.165.29 with SMTP id i29mr7548472wrb.163.1506697529856; Fri, 29 Sep 2017 08:05:29 -0700 (PDT) Received: from redhat.com (red-hat-inc.vlan404.asr1.mad1.gblx.net. [64.215.113.190]) by smtp.gmail.com with ESMTPSA id t141sm5210881wme.33.2017.09.29.08.05.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Sep 2017 08:05:28 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Fri, 29 Sep 2017 17:05:23 +0200 Message-Id: <20170929150523.8833-3-jkbs@redhat.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170929150523.8833-1-jkbs@redhat.com> References: <20170929150523.8833-1-jkbs@redhat.com> X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 2/2] ovn-northd; Treat logical ports of router type as always being up X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Employ the simplest possible approach to determine the state of logical ports that connect to logical routers by hardcoding it to always up. This is intended to be less surprising than the current approach where router ports appear as being down (with the exception of ones linking to gateway routers, which are bound). Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2017-August/045202.html Signed-off-by: Jakub Sitnicki Acked-by: Mark Michelson Acked-by: Miguel Angel Ajo --- ovn/northd/ovn-northd.c | 2 +- ovn/ovn-nb.xml | 26 +++++++++++++------ tests/ovn-northd.at | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 9 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 37651a0..791da1e 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -5980,7 +5980,7 @@ update_logical_port_status(struct northd_context *ctx) continue; } - bool up = sb->chassis ? true : false; + bool up = (sb->chassis || !strcmp(nbsp->type, "router")); if (!nbsp->up || *nbsp->up != up) { nbrec_logical_switch_port_set_up(nbsp, &up, 1); } diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index 9869d7e..5b02269 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -513,14 +513,24 @@ - This column is populated by ovn-northd, rather than by the - CMS plugin as is most of this database. When a logical port is bound - to a physical location in the OVN Southbound database table, ovn-northd - sets this column to true; otherwise, or if the port - becomes unbound later, it sets it to false. This allows - the CMS to wait for a VM's (or container's) networking to become active - before it allows the VM (or container) to start. +

+ This column is populated by ovn-northd, rather + than by the CMS plugin as is most of this database. When a + logical port is bound to a physical location in the OVN + Southbound database table, ovn-northd sets this + column to true; otherwise, or if the port + becomes unbound later, it sets it to false. + This allows the CMS to wait for a VM's (or container's) + networking to become active before it allows the VM (or + container) to start. +

+ +

+ Logical ports of router type are an exception to this rule. + They are considered to be always up, that is this column is + always set to true. +

diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index fc9eda8..954e259 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -83,3 +83,72 @@ ovn-nbctl --wait=sb remove Logical_Router_Port bob options redirect-chassis AT_CHECK([ovn-sbctl find Gateway_Chassis name=bob_gw1], [0], []) AT_CLEANUP + +AT_SETUP([ovn -- check up state of VIF LSP]) +AT_SKIP_IF([test $HAVE_PYTHON = no]) +ovn_start + +ovn-nbctl ls-add S1 +ovn-nbctl lsp-add S1 S1-vm1 +AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xdown]) + +ovn-sbctl chassis-add hv1 geneve 127.0.0.1 +ovn-sbctl lsp-bind S1-vm1 hv1 +AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xup]) + +AT_CLEANUP + +AT_SETUP([ovn -- check up state of router LSP linked to a distributed LR]) +AT_SKIP_IF([test $HAVE_PYTHON = no]) +ovn_start + +ovn-nbctl lr-add R1 +ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24 + +ovn-nbctl ls-add S1 +ovn-nbctl lsp-add S1 S1-R1 +ovn-nbctl lsp-set-type S1-R1 router +ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01 +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 +AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup]) + +AT_CLEANUP + +AT_SETUP([ovn -- check up state of router LSP linked to a gateway LR]) +AT_SKIP_IF([test $HAVE_PYTHON = no]) +ovn_start + +ovn-sbctl chassis-add gw1 geneve 127.0.0.1 + +ovn-nbctl create Logical_Router name=R1 options:chassis=gw1 +ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24 + +ovn-nbctl ls-add S1 +ovn-nbctl lsp-add S1 S1-R1 +ovn-nbctl lsp-set-type S1-R1 router +ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01 +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 + +ovn-sbctl lsp-bind S1-R1 gw1 +AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup]) + +AT_CLEANUP + +AT_SETUP([ovn -- check up state of router LSP linked to an LRP with set Gateway Chassis]) +AT_SKIP_IF([test $HAVE_PYTHON = no]) +ovn_start + +ovn-sbctl chassis-add gw1 geneve 127.0.0.1 + +ovn-nbctl lr-add R1 +ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24 +ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 + +ovn-nbctl ls-add S1 +ovn-nbctl lsp-add S1 S1-R1 +ovn-nbctl lsp-set-type S1-R1 router +ovn-nbctl lsp-set-addresses S1-R1 router +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 +AT_CHECK([test x`ovn-nbctl lsp-get-up S1-R1` = xup]) + +AT_CLEANUP