From patchwork Mon Sep 12 22:11:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1677091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kTvLubb3; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MRLQs0Tnrz1ync for ; Tue, 13 Sep 2022 08:11:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9F22E415D4; Mon, 12 Sep 2022 22:11:14 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9F22E415D4 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kTvLubb3 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 nIl8nb-VtUwI; Mon, 12 Sep 2022 22:11:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 528204156A; Mon, 12 Sep 2022 22:11:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 528204156A Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 118E1C0033; Mon, 12 Sep 2022 22:11:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2006EC002D for ; Mon, 12 Sep 2022 22:11:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E80154013B for ; Mon, 12 Sep 2022 22:11:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E80154013B Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kTvLubb3 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j0sy1NRfjys2 for ; Mon, 12 Sep 2022 22:11:09 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org EFB4D40562 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by smtp2.osuosl.org (Postfix) with ESMTPS id EFB4D40562 for ; Mon, 12 Sep 2022 22:11:08 +0000 (UTC) Received: by mail-lf1-x12d.google.com with SMTP id i26so17093748lfp.11 for ; Mon, 12 Sep 2022 15:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=TSvEvoO1/gBAjmEJF9rD3r/LXyLHzcJWKxGH4oGOHXY=; b=kTvLubb3ZUEobN3Ykm7QeUS+mcJa1kB6D4oOPQv1cLdofKoGqqiXrAOwXehaxyxbdM IvJIyixANukkOmkgZ3LhnR8JIain28rLbjKwVXNGFhsZixxW6pxYe2Mlv9PK3T7WwRm9 nz47rTuy8FBkXrSXLV5WMcJb5SqVg4k2YeSVGObyOZ4r5l1Yvam57SnOj0p+wi0RSDm4 OLXIze6712bSf4scuZEGfiDugBUiEEfhC3L0ecakaf0vi92EDniUGGPo/1dbYMgjKeXM ZFRQTarYhcB7BNSuezKwQ67R1SNwBqCeNSNpnKt0vwQIN1+JOA0cAC5kqgL9TGlPtMtR 9kRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=TSvEvoO1/gBAjmEJF9rD3r/LXyLHzcJWKxGH4oGOHXY=; b=G60MSQShIhnjMnleYLAHA0IggZWJpblrBJhtE0s7i+NZ7AATFjWcrd4nCKyIOVnkCJ vTGltMIN9yMUWx/tYOo6FLr+b101AiEgc219lene5GpuukAmo/Od+kGDvdCN8AL/VCAN EVTYzUOTE9qykoCq32FGn5RIOBV608q77KkTdOrdNACdABo87J5604Xl4Ag3/B/kZ88X buwBuHNKrt3nhC6vv77Dw/PMYZjLQfsofAddZ0GvYzzf2Ewyrl8D7ZsZ3ADG+vcJu0h4 gN6J5MtUD5ldLTLhQtO3I2Xz19lURwkjiUsfG4Uyzs+d95nEg6Wrq4Mkaauegkt1FsjC zFlQ== X-Gm-Message-State: ACgBeo1qCj4wsyfKCfxXrmF01Ym1Z2kCITnDs6jRqpXr8hX2qDsHxMH4 Swm4R6OSFj+qMHGmBIqptKu6+PrsOGw= X-Google-Smtp-Source: AA6agR7pckgHiFZqWZijtpBu56Ru6Zlb1TQ2vDZbpjKOYE3CyW2VG7P5ObmNxIjUIQ9p46qqYb2gpg== X-Received: by 2002:a05:6512:3c92:b0:499:a1ff:d6f3 with SMTP id h18-20020a0565123c9200b00499a1ffd6f3mr4559756lfv.153.1663020666280; Mon, 12 Sep 2022 15:11:06 -0700 (PDT) Received: from ip-10-70-112-12.vpc-1e810be1.internal (c2-178-216-98-9.elastic.cloud.croc.ru. [178.216.98.9]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b0049a148eb003sm955064lfs.178.2022.09.12.15.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 15:11:05 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Tue, 13 Sep 2022 01:11:04 +0300 Message-Id: <20220912221104.2679484-1-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn] northd: don't include disabled LSP's IP to Load Balancing 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" If one has a UDP load balancer with backend IP which is located under disabled LSP, such backend would be threated as alive and marked as 'online' on Service_Monitor table and added to load balancing as well. Though such LSP can't receive any traffic, this load balancer will be broken by mentioned behaviour. This patch resolves this issue for Load Balancers with enabled health check: if LSP is disabled, it wont be added to Service_Monitor and to Load Balancing flow. Signed-off-by: Vladislav Odintsov --- northd/northd.c | 10 ++++++---- tests/ovn-northd.at | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 1eb190dc1..76007bd4d 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -3713,7 +3713,8 @@ ovn_lb_svc_create(struct ovsdb_idl_txn *ovnsb_txn, struct ovn_northd_lb *lb, backend_nb->op = op; backend_nb->svc_mon_src_ip = svc_mon_src_ip; - if (!lb_vip_nb->lb_health_check || !op || !svc_mon_src_ip) { + if (!lb_vip_nb->lb_health_check || !op || !svc_mon_src_ip || + !lsp_is_enabled(op->nbsp)) { continue; } @@ -3777,9 +3778,10 @@ build_lb_vip_actions(struct ovn_lb_vip *lb_vip, struct ovn_lb_backend *backend = &lb_vip->backends[i]; struct ovn_northd_lb_backend *backend_nb = &lb_vip_nb->backends_nb[i]; - if (backend_nb->health_check && backend_nb->sbrec_monitor && - backend_nb->sbrec_monitor->status && - strcmp(backend_nb->sbrec_monitor->status, "online")) { + if (!backend_nb->health_check || + (backend_nb->health_check && backend_nb->sbrec_monitor && + backend_nb->sbrec_monitor->status && + strcmp(backend_nb->sbrec_monitor->status, "online"))) { continue; } diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index da83bce7c..7c3c84007 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1230,6 +1230,25 @@ OVS_WAIT_FOR_OUTPUT( (ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(reg0[[1]] = 0; ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) +# disabled LSPs should not be a backend of Load Balancer +check ovn-nbctl lsp-set-enabled sw0-p1 disabled + +AT_CAPTURE_FILE([sbflows]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows | grep 'priority=120.*backends' | sed 's/table=..//'], 0, [dnl + (ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(reg0[[1]] = 0; ct_lb(backends=20.0.0.3:80);) +]) +wait_row_count Service_Monitor 1 + +check ovn-nbctl lsp-set-enabled sw0-p1 enabled + +AT_CAPTURE_FILE([sbflows]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows | grep 'priority=120.*backends' | sed 's/table=..//'], 0, [dnl + (ls_in_lb ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(reg0[[1]] = 0; ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +]) +wait_row_count Service_Monitor 2 + AS_BOX([Delete the Load_Balancer_Health_Check]) ovn-nbctl --wait=sb clear load_balancer . health_check wait_row_count Service_Monitor 0