From patchwork Thu Dec 15 17:02:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1716212 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=2605:bc80:3010::138; helo=smtp1.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=Ccg1m2+n; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4NXz7J03kcz2403 for ; Fri, 16 Dec 2022 04:02:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2CEBE820A9; Thu, 15 Dec 2022 17:02:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2CEBE820A9 Authentication-Results: smtp1.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=Ccg1m2+n X-Virus-Scanned: amavisd-new at osuosl.org 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 76JhlClME43X; Thu, 15 Dec 2022 17:02:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1CF178205D; Thu, 15 Dec 2022 17:02:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1CF178205D Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E0AA1C0035; Thu, 15 Dec 2022 17:02:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id B184AC0032 for ; Thu, 15 Dec 2022 17:02:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8B09760B30 for ; Thu, 15 Dec 2022 17:02:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8B09760B30 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Ccg1m2+n X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n7rhkuMlNgJE for ; Thu, 15 Dec 2022 17:02:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8F99F607AA Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8F99F607AA for ; Thu, 15 Dec 2022 17:02:29 +0000 (UTC) Received: by mail-wr1-x432.google.com with SMTP id h10so3770992wrx.3 for ; Thu, 15 Dec 2022 09:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NgIg//UgV7CnztC5Xgp0C1SqVfc1iG/GcJgs8R53r/8=; b=Ccg1m2+nAZac3qKCzBAdHZIRR4Q1nbYQbHKvjThPIqRxIIR+mLdtC1mloMyuCo1UUO O9vrajIfRI2QG4YN3fMW88Nc7v6qQ+UPCX4ONINCaJA2mChmRqoXB0n1/hViBEPItOy1 wf4E5kn3NsRSSdeerVZOFP1pGFOLWnps9ZoeECkftQcKM3+CCEflYYhQVHxIyKJvOT1T kGd79liLSDEb240RUUrjHxuiw6TBMClhtyKFWNHM5dZENvwcwwSSk3jecB7Cq447EYzb v6kI+GodfqvlQ1B4xJ3QtTfNHXofwrAil97H7r3VZU3ay8ei9GFKUOoWelllTwgUVGj2 hKmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NgIg//UgV7CnztC5Xgp0C1SqVfc1iG/GcJgs8R53r/8=; b=CewwvxGU+eHdMElAey0mluyN9Mu7MlpcbXzMzdbxBx/Vn0AwdyBlArOF1dLeaZDGM0 YQ4jTEtrltiJq4T782ydWQVE09+t6zMlQzkM9Tm93iT3ZlhSqtUKiiw4HLQPTF+GbSrL pp4mECf2Rah0Oxf/rDpPS2tZKzz4uHMVb5LBBzUB85Yj76TkYRDUaxn2XAHDgYhjhzFN vUECEJ3HAaQfv08WsGdib0655f/LgTKsqCZJJ8xhS/Grd1+10ZEYe/KviOkjMv4Zu8sW SKFxqaBHi0CbWxXnvBe5r3FC2Sw7+wnVC39Zq5l14XDwTJlqLJVadWay80Q8dLBHkO+T UYUw== X-Gm-Message-State: ANoB5pmtf1cHNopW5SVZY3fvQCVpDS21d2KaxgJi73ZoqYSdGhuaavKa +xZU7levdOzN5mb0vDkHeQiE5g1MjxcH+sQM X-Google-Smtp-Source: AA0mqf5DM3r8QrUe4KutRcQRMHDGzwnHrihg2dP7h2Kg7bXdK5sNwYRqXSSfbhDUiZ38jZQHPFMAig== X-Received: by 2002:a5d:4745:0:b0:242:2fa:fa49 with SMTP id o5-20020a5d4745000000b0024202fafa49mr18914544wrs.18.1671123747375; Thu, 15 Dec 2022 09:02:27 -0800 (PST) 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 q6-20020adff506000000b0022e57e66824sm7429148wro.99.2022.12.15.09.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:02:26 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 15 Dec 2022 20:02:15 +0300 Message-Id: <20221215170219.3072151-2-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221215170219.3072151-1-odivlad@gmail.com> References: <20221215170219.3072151-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Dumitru Ceara , Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 1/5] ic: remove orphan ovn interconnection routes 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" Before this patch if one deletes transit switch through which there were routes in ICSB:Route table, such routes were left forever in the DB. Now we validate that each ICSB:Route has an appropriate transit switch. Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- ic/ovn-ic.c | 41 +++++++++++++++++++++++++++ tests/ovn-ic.at | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index e5c193d9d..2bc96d36c 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -71,6 +71,7 @@ struct ic_context { struct ovsdb_idl_index *icsbrec_port_binding_by_az; struct ovsdb_idl_index *icsbrec_port_binding_by_ts; struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az; + struct ovsdb_idl_index *icsbrec_route_by_az; struct ovsdb_idl_index *icsbrec_route_by_ts; struct ovsdb_idl_index *icsbrec_route_by_ts_az; }; @@ -1612,6 +1613,39 @@ advertise_lr_routes(struct ic_context *ctx, hmap_destroy(&routes_ad); } +static void +delete_orphan_ic_routes(struct ic_context *ctx, + const struct icsbrec_availability_zone *az) +{ + const struct icsbrec_route *isb_route, *isb_route_key = + icsbrec_route_index_init_row(ctx->icsbrec_route_by_az); + icsbrec_route_index_set_availability_zone(isb_route_key, az); + + const struct icnbrec_transit_switch *t_sw, *t_sw_key; + + ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key, + ctx->icsbrec_route_by_az) + { + t_sw_key = icnbrec_transit_switch_index_init_row( + ctx->icnbrec_transit_switch_by_name); + icnbrec_transit_switch_index_set_name(t_sw_key, + isb_route->transit_switch); + t_sw = icnbrec_transit_switch_index_find( + ctx->icnbrec_transit_switch_by_name, t_sw_key); + icnbrec_transit_switch_index_destroy_row(t_sw_key); + + if (!t_sw) { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); + VLOG_INFO_RL(&rl, "Deleting orphan ICDB:Route: %s->%s (%s, rtb:%s," + " transit switch: %s)", isb_route->ip_prefix, + isb_route->nexthop, isb_route->origin, + isb_route->route_table, isb_route->transit_switch); + icsbrec_route_delete(isb_route); + } + } + icsbrec_route_index_destroy_row(isb_route_key); +} + static void route_run(struct ic_context *ctx, const struct icsbrec_availability_zone *az) @@ -1620,6 +1654,8 @@ route_run(struct ic_context *ctx, return; } + delete_orphan_ic_routes(ctx, az); + struct hmap ic_lrs = HMAP_INITIALIZER(&ic_lrs); const struct icsbrec_port_binding *isb_pb; const struct icsbrec_port_binding *isb_pb_key = @@ -1908,6 +1944,10 @@ main(int argc, char *argv[]) &icsbrec_port_binding_col_transit_switch, &icsbrec_port_binding_col_availability_zone); + struct ovsdb_idl_index *icsbrec_route_by_az + = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, + &icsbrec_route_col_availability_zone); + struct ovsdb_idl_index *icsbrec_route_by_ts = ovsdb_idl_index_create1(ovnisb_idl_loop.idl, &icsbrec_route_col_transit_switch); @@ -1962,6 +2002,7 @@ main(int argc, char *argv[]) .icsbrec_port_binding_by_az = icsbrec_port_binding_by_az, .icsbrec_port_binding_by_ts = icsbrec_port_binding_by_ts, .icsbrec_port_binding_by_ts_az = icsbrec_port_binding_by_ts_az, + .icsbrec_route_by_az = icsbrec_route_by_az, .icsbrec_route_by_ts = icsbrec_route_by_ts, .icsbrec_route_by_ts_az = icsbrec_route_by_ts_az, }; diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 0bdfc55e6..e234b7fb9 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -121,6 +121,79 @@ OVN_CLEANUP_IC AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- route deletion upon TS deletion]) + +ovn_init_ic_db +net_add n1 + +# 1 GW per AZ +for i in 1 2; do + az=az$i + ovn_start $az + sim_add gw-$az + as gw-$az + check ovs-vsctl add-br br-phys + ovn_az_attach $az n1 br-phys 192.168.1.$i + check ovs-vsctl set open . external-ids:ovn-is-interconn=true + check ovn-nbctl set nb-global . \ + options:ic-route-adv=true \ + options:ic-route-adv-default=true \ + options:ic-route-learn=true \ + options:ic-route-learn-default=true +done + +create_ic_infra() { + az_id=$1 + ts_id=$2 + az=az$i + + lsp=lsp${az_id}-${ts_id} + lrp=lrp${az_id}-${ts_id} + ts=ts${az_id}-${ts_id} + lr=lr${az_id}-${ts_id} + + ovn_as $az + + check ovn-ic-nbctl ts-add $ts + check ovn-nbctl lr-add $lr + check ovn-nbctl lrp-add $lr $lrp 00:00:00:00:00:0$az_id 10.0.$az_id.1/24 + check ovn-nbctl lrp-set-gateway-chassis $lrp gw-$az + + check ovn-nbctl lsp-add $ts $lsp -- \ + lsp-set-addresses $lsp router -- \ + lsp-set-type $lsp router -- \ + lsp-set-options $lsp router-port=$lrp + + check ovn-nbctl lr-route-add $lr 192.168.0.0/16 10.0.$az_id.10 +} + +create_ic_infra 1 1 +create_ic_infra 1 2 +create_ic_infra 2 1 + +ovn_as az1 + +wait_row_count ic-sb:Route 3 ip_prefix=192.168.0.0/16 + +# remove transit switch 1 (from az1) and check if its route is deleted +# same route from another AZ and ts should remain, as +check ovn-ic-nbctl ts-del ts1-1 +sleep 2 +ovn-ic-sbctl list route +ovn-ic-nbctl list transit_switch +wait_row_count ic-sb:route 2 ip_prefix=192.168.0.0/16 +ovn-ic-sbctl list route + +for i in 1 2; do + az=az$i + OVN_CLEANUP_SBOX(gw-$az) + OVN_CLEANUP_AZ([$az]) +done +OVN_CLEANUP_IC +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD([ AT_SETUP([ovn-ic -- gateway sync]) From patchwork Thu Dec 15 17:02:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1716213 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=2605:bc80:3010::136; helo=smtp3.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=oxV8kWrz; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4NXz7L1322z240X for ; Fri, 16 Dec 2022 04:02:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 229AD6106B; Thu, 15 Dec 2022 17:02:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 229AD6106B Authentication-Results: smtp3.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=oxV8kWrz X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fu3eCVWa-bx9; Thu, 15 Dec 2022 17:02:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0FEE6607AA; Thu, 15 Dec 2022 17:02:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0FEE6607AA Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C9B10C007C; Thu, 15 Dec 2022 17:02:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id EE3AFC007D for ; Thu, 15 Dec 2022 17:02:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BA4F540FC2 for ; Thu, 15 Dec 2022 17:02:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org BA4F540FC2 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=oxV8kWrz 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 jLzR0GOSSEY6 for ; Thu, 15 Dec 2022 17:02:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D359540FCA Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by smtp2.osuosl.org (Postfix) with ESMTPS id D359540FCA for ; Thu, 15 Dec 2022 17:02:31 +0000 (UTC) Received: by mail-wr1-x42f.google.com with SMTP id y16so3777076wrm.2 for ; Thu, 15 Dec 2022 09:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zV+wG6doW892j71/zgHKdlvFmsrNPl/7AP7CeeU+Gng=; b=oxV8kWrzNBJiMnniHcpXUiSo8LLYmCaBnNXsyDOmDvjAowJebSHGCj0qi6srEfiuC/ XYs/Aqco2/msipBbVw3JmAsk+EF5GNS5fn3RTtX4eDVqtD2x4/PwyHMOD8USWue05CSd xIl/te3mshMjTsaVLpHlNhDGr9DYhpqVSWobXKMVP3pnm0vteIWKDH7FIXFS3/sCKmAX Sqy5YD2IXdNEXCJFG8KKjRn8QuCcKarGLYbcAn9tgG8MsgZRj36rX0AtRhAZxuJrAUZu Of5Jcz+8lmCbQjXmsvRky7SIx6PbxtfvFwQDdbsN/EB4T1fkbWyi4NxIT87NtT0PPNSh Uuww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zV+wG6doW892j71/zgHKdlvFmsrNPl/7AP7CeeU+Gng=; b=Qi8fzrCFO19JrIawT050hU2d1Y+Wrj6wIlwptRs3TqOxIc/CMj8mjO085el7vQ86Yf TtMJfsH0ht8l+CZKpQ8QFJsTr2Xyis0p/KqR0aalor2OAFJTE+AWqHflQUuUk9sIm2/A imKsq7WHx/YzRH10wqkglnk7P7Hcj7P2ej8vH+265yZDFcdJhibLJs8RaS8ROZU06efy REfA124/SvOh4wTIGnR5SOTVzgp+ROmt3h80mWkqfR8tLdbjaepCLACun/lhx32NGJiB puoPHoimiWMOcLehkC3GJzD9zzrNGivsHgwT3JVMM/ZcCnUrnGJ/gturfTuWeBlFXEvG WQZA== X-Gm-Message-State: ANoB5pnIa0c0EcSR0QdZ5fRL6p+f2fgWAtRtj7ujWkloANoBMRMCQeLL BHKc6DvVpmUOIaLRVVxruIHW8kaecxlx+Zr6 X-Google-Smtp-Source: AA0mqf4Lr4+K9vFi54jDm/leJHpKChtElVxuOQalbYMB8jKv+jMZoq3yo/apkGN02KxYxGwJUbOZLg== X-Received: by 2002:a05:6000:550:b0:242:880:20ce with SMTP id b16-20020a056000055000b00242088020cemr19520937wrf.47.1671123749822; Thu, 15 Dec 2022 09:02:29 -0800 (PST) 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 q6-20020adff506000000b0022e57e66824sm7429148wro.99.2022.12.15.09.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:02:29 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 15 Dec 2022 20:02:16 +0300 Message-Id: <20221215170219.3072151-3-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221215170219.3072151-1-odivlad@gmail.com> References: <20221215170219.3072151-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Dumitru Ceara , Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 2/5] ic: lookup southbound port_binding only if needed 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" Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- ic/ovn-ic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 2bc96d36c..0d5e5f5d9 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -757,6 +757,7 @@ port_binding_run(struct ic_context *ctx, } icsbrec_port_binding_index_destroy_row(isb_pb_key); + const struct sbrec_port_binding *sb_pb; const struct icnbrec_transit_switch *ts; ICNBREC_TRANSIT_SWITCH_FOR_EACH (ts, ctx->ovninb_idl) { const struct nbrec_logical_switch *ls = find_ts_in_nb(ctx, ts->name); @@ -788,9 +789,9 @@ port_binding_run(struct ic_context *ctx, for (int i = 0; i < ls->n_ports; i++) { lsp = ls->ports[i]; - const struct sbrec_port_binding *sb_pb = find_lsp_in_sb(ctx, lsp); if (!strcmp(lsp->type, "router")) { /* The port is local. */ + sb_pb = find_lsp_in_sb(ctx, lsp); if (!sb_pb) { continue; } @@ -807,6 +808,7 @@ port_binding_run(struct ic_context *ctx, if (!isb_pb) { nbrec_logical_switch_update_ports_delvalue(ls, lsp); } else { + sb_pb = find_lsp_in_sb(ctx, lsp); if (!sb_pb) { continue; } From patchwork Thu Dec 15 17:02:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1716214 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=2605:bc80:3010::136; helo=smtp3.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=TcrfpjC+; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4NXz891C6gz2403 for ; Fri, 16 Dec 2022 04:03:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6AAD46107D; Thu, 15 Dec 2022 17:03:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6AAD46107D Authentication-Results: smtp3.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=TcrfpjC+ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oSrZg7bzvdf1; Thu, 15 Dec 2022 17:03:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5C8E46105C; Thu, 15 Dec 2022 17:03:17 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5C8E46105C Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DE4ACC0035; Thu, 15 Dec 2022 17:03:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 50100C002D for ; Thu, 15 Dec 2022 17:03:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 87DBA61076 for ; Thu, 15 Dec 2022 17:02:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 87DBA61076 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MLqXrxpQQjlI for ; Thu, 15 Dec 2022 17:02:43 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4E5246106F Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4E5246106F for ; Thu, 15 Dec 2022 17:02:43 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id h7so3764949wrs.6 for ; Thu, 15 Dec 2022 09:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/0FCgq37J0KJIFTc4tV69Tf7q/FXzaV16M0B3YFyT5c=; b=TcrfpjC+UnempR2dAvxNx5rK7KPP9SFIn8tjTz2Mx+l46TAv3iuUbXnFAY6gwzfiY7 efwdQQh4lKHG/7qnrG9oiQzGLFzohpA6iz/9Im+QbLL9xirkASTzT7KrW09/TqhzmeNP cGL6Y24Cd+O9YUf15sJ/ty3/zWSimVwcThh8LUGtES4vFlFhfQ7sT2LSwnEs9q4PsNwo fZuync8/FLcSoTZojeHYfNk9GA9bco6aBEKP9GdI6HqaZ/TXQWI15b0R7bNY/k5f+JFr 05seMkjP94cH79H57sQVs10bDWgxZkbgzQqxCgCvjB9QMrVI0wiTeniheUHCoJJI59ti 4HuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/0FCgq37J0KJIFTc4tV69Tf7q/FXzaV16M0B3YFyT5c=; b=sdqu7/sIF+jPEeCkNpdMR54meMFzpO2dq7RniUSguoU+6QRaNJPbrVvZYuuArYCKKa OvX7Qq3j5VzQz8KOxYMWItlJAi+pffgzhN8c/LskpJu3AQ5M3FduytZOoOnzocte34uU vjGdgploL4H57Su8aBOXAzVg4+39d/R0U/bSRw2FCWrxBG4sG04rytKNVwPoT4LVXSjP Tzfyxksfzhve+GcMYvGW33eZvi2vDIpdPbCBPsltxX215gzh2wm0xs/z4iGfPDo9Ohfi SeflXV/FobpKV4VDZy1Xs4bTG5xhvsqMelk/dYfdm5KW8I7Z6kwWSNbR8JKNtVofaJqS evRg== X-Gm-Message-State: ANoB5pkzgRX88u5zW8nfBLfBbgPTKMThSLeomkf4LEpVoIFYt0D/V1Zf nlz7qIiIuV8Oy9SQsTS3aAZHXDY9VEZzJRGt X-Google-Smtp-Source: AA0mqf4EMZBIdU8wBMUC1vW7bCxhf3qRnglio5ULu6XnKj3MKg1yMEwqOtfJlgv6Jqr1Lk6WJyOwqA== X-Received: by 2002:adf:f14c:0:b0:24f:dbcd:7726 with SMTP id y12-20020adff14c000000b0024fdbcd7726mr11819249wro.5.1671123762574; Thu, 15 Dec 2022 09:02:42 -0800 (PST) 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 q6-20020adff506000000b0022e57e66824sm7429148wro.99.2022.12.15.09.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:02:42 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 15 Dec 2022 20:02:17 +0300 Message-Id: <20221215170219.3072151-4-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221215170219.3072151-1-odivlad@gmail.com> References: <20221215170219.3072151-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 3/5] ic: prevent advertising/learning multiple same routes 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" Advertize one route (ip_prefix, nexthop, route_table, transit_switch, availability_zone) only once. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 84 ++++++++++++++++++++++++++++++------------------- tests/ovn-ic.at | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 33 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 0d5e5f5d9..518796149 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -884,10 +884,12 @@ ic_route_hash(const struct in6_addr *prefix, unsigned int plen, static struct ic_route_info * ic_route_find(struct hmap *routes, const struct in6_addr *prefix, unsigned int plen, const struct in6_addr *nexthop, - const char *origin, char *route_table) + const char *origin, const char *route_table, uint32_t hash) { struct ic_route_info *r; - uint32_t hash = ic_route_hash(prefix, plen, nexthop, origin, route_table); + if (!hash) { + hash = ic_route_hash(prefix, plen, nexthop, origin, route_table); + } HMAP_FOR_EACH_WITH_HASH (r, node, hash, routes) { if (ipv6_addr_equals(&r->prefix, prefix) && r->plen == plen && @@ -945,8 +947,8 @@ add_to_routes_learned(struct hmap *routes_learned, } const char *origin = smap_get_def(&nb_route->options, "origin", ""); if (ic_route_find(routes_learned, &prefix, plen, &nexthop, origin, - nb_route->route_table)) { - /* Route is already added to learned in previous iteration. */ + nb_route->route_table, 0)) { + /* Route was added to learned on previous iteration. */ return true; } @@ -1093,10 +1095,43 @@ route_need_advertise(const char *policy, } static void -add_to_routes_ad(struct hmap *routes_ad, - const struct nbrec_logical_router_static_route *nb_route, - const struct lport_addresses *nexthop_addresses, - const struct smap *nb_options, const char *route_table) +add_to_routes_ad(struct hmap *routes_ad, const struct in6_addr prefix, + unsigned int plen, const struct in6_addr nexthop, + const char *origin, const char *route_table, + const struct nbrec_logical_router_port *nb_lrp, + const struct nbrec_logical_router_static_route *nb_route) +{ + if (route_table == NULL) { + route_table = ""; + } + + uint hash = ic_route_hash(&prefix, plen, &nexthop, origin, route_table); + + if (!ic_route_find(routes_ad, &prefix, plen, &nexthop, origin, route_table, + hash)) { + struct ic_route_info *ic_route = xzalloc(sizeof *ic_route); + ic_route->prefix = prefix; + ic_route->plen = plen; + ic_route->nexthop = nexthop; + ic_route->nb_route = nb_route; + ic_route->origin = origin; + ic_route->route_table = route_table; + ic_route->nb_lrp = nb_lrp; + hmap_insert(routes_ad, &ic_route->node, hash); + } else { + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); + VLOG_WARN_RL(&rl, "Duplicate route advertisement was suppressed! NB " + "route uuid: "UUID_FMT, + UUID_ARGS(&nb_route->header_.uuid)); + } +} + +static void +add_static_to_routes_ad( + struct hmap *routes_ad, + const struct nbrec_logical_router_static_route *nb_route, + const struct lport_addresses *nexthop_addresses, + const struct smap *nb_options, const char *route_table) { if (strcmp(route_table, nb_route->route_table)) { if (VLOG_IS_DBG_ENABLED()) { @@ -1145,16 +1180,8 @@ add_to_routes_ad(struct hmap *routes_ad, ds_destroy(&msg); } - struct ic_route_info *ic_route = xzalloc(sizeof *ic_route); - ic_route->prefix = prefix; - ic_route->plen = plen; - ic_route->nexthop = nexthop; - ic_route->nb_route = nb_route; - ic_route->origin = ROUTE_ORIGIN_STATIC; - ic_route->route_table = nb_route->route_table; - hmap_insert(routes_ad, &ic_route->node, - ic_route_hash(&prefix, plen, &nexthop, ROUTE_ORIGIN_STATIC, - nb_route->route_table)); + add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_STATIC, + nb_route->route_table, NULL, nb_route); } static void @@ -1198,18 +1225,9 @@ add_network_to_routes_ad(struct hmap *routes_ad, const char *network, ds_destroy(&msg); } - struct ic_route_info *ic_route = xzalloc(sizeof *ic_route); - ic_route->prefix = prefix; - ic_route->plen = plen; - ic_route->nexthop = nexthop; - ic_route->nb_lrp = nb_lrp; - ic_route->origin = ROUTE_ORIGIN_CONNECTED; - /* directly-connected routes go to
route table */ - ic_route->route_table = NULL; - hmap_insert(routes_ad, &ic_route->node, - ic_route_hash(&prefix, plen, &nexthop, - ROUTE_ORIGIN_CONNECTED, "")); + add_to_routes_ad(routes_ad, prefix, plen, nexthop, ROUTE_ORIGIN_CONNECTED, + NULL, nb_lrp, NULL); } static bool @@ -1369,7 +1387,7 @@ sync_learned_routes(struct ic_context *ctx, struct ic_route_info *route_learned = ic_route_find(&ic_lr->routes_learned, &prefix, plen, &nexthop, isb_route->origin, - isb_route->route_table); + isb_route->route_table, 0); if (route_learned) { /* Sync external-ids */ struct uuid ext_id; @@ -1468,7 +1486,7 @@ advertise_routes(struct ic_context *ctx, } struct ic_route_info *route_adv = ic_route_find(routes_ad, &prefix, plen, &nexthop, - isb_route->origin, isb_route->route_table); + isb_route->origin, isb_route->route_table, 0); if (!route_adv) { /* Delete the extra route from IC-SB. */ VLOG_DBG("Delete route %s -> %s from IC-SB, which is not found" @@ -1550,8 +1568,8 @@ build_ts_routes_to_adv(struct ic_context *ctx, } } else { /* It may be a route to be advertised */ - add_to_routes_ad(routes_ad, nb_route, ts_port_addrs, - &nb_global->options, ts_route_table); + add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, + &nb_global->options, ts_route_table); } } diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index e234b7fb9..ceee45092 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -194,6 +194,66 @@ OVN_CLEANUP_IC AT_CLEANUP ]) +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- duplicate NB route adv/learn]) + +ovn_init_ic_db +net_add n1 + +# 1 GW per AZ +for i in 1 2; do + az=az$i + ovn_start $az + sim_add gw-$az + as gw-$az + check ovs-vsctl add-br br-phys + ovn_az_attach $az n1 br-phys 192.168.1.$i + check ovs-vsctl set open . external-ids:ovn-is-interconn=true + check ovn-nbctl set nb-global . \ + options:ic-route-adv=true \ + options:ic-route-adv-default=true \ + options:ic-route-learn=true \ + options:ic-route-learn-default=true +done + +ovn_as az1 + +# create transit switch and connect to LR +check ovn-ic-nbctl ts-add ts1 +for i in 1 2; do + ovn_as az$i + + check ovn-nbctl lr-add lr1 + check ovn-nbctl lrp-add lr1 lrp$i 00:00:00:00:0$i:01 10.0.$i.1/24 + check ovn-nbctl lrp-set-gateway-chassis lrp$i gw-az$i + + check ovn-nbctl lsp-add ts1 lsp$i -- \ + lsp-set-addresses lsp$i router -- \ + lsp-set-type lsp$i router -- \ + lsp-set-options lsp$i router-port=lrp$i +done + +ovn_as az1 + +ovn-nbctl \ + --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \ + add logical-router lr1 static_routes @id +ovn-nbctl \ + --id=@id create logical-router-static-route ip_prefix=1.1.1.1/32 nexthop=10.0.1.10 -- \ + add logical-router lr1 static_routes @id + +wait_row_count ic-sb:route 1 ip_prefix=1.1.1.1/32 + +for i in 1 2; do + az=az$i + OVN_CLEANUP_SBOX(gw-$az) + OVN_CLEANUP_AZ([$az]) +done + +OVN_CLEANUP_IC +AT_CLEANUP +]) + OVN_FOR_EACH_NORTHD([ AT_SETUP([ovn-ic -- gateway sync]) From patchwork Thu Dec 15 17:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1716215 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.133; helo=smtp2.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=V8dXaA9w; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4NXz8G1MJLz2403 for ; Fri, 16 Dec 2022 04:03:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3AF8E4101B; Thu, 15 Dec 2022 17:03:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3AF8E4101B Authentication-Results: smtp2.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=V8dXaA9w 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 Z4WfTMdNQIID; Thu, 15 Dec 2022 17:03:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 4E35B41022; Thu, 15 Dec 2022 17:03:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 4E35B41022 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1372EC007D; Thu, 15 Dec 2022 17:03:22 +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 2DD79C007C for ; Thu, 15 Dec 2022 17:03:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9C041820CD for ; Thu, 15 Dec 2022 17:02:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9C041820CD Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=V8dXaA9w X-Virus-Scanned: amavisd-new at osuosl.org 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 ah9suQw1NqPb for ; Thu, 15 Dec 2022 17:02:48 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9F2E9820D4 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9F2E9820D4 for ; Thu, 15 Dec 2022 17:02:48 +0000 (UTC) Received: by mail-wr1-x42e.google.com with SMTP id u12so3732939wrr.11 for ; Thu, 15 Dec 2022 09:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YGxrlqa8FTYGUSfVMlirKQb9dOlLy2j5nLcGrU15r8g=; b=V8dXaA9wd7p/0VyQ2iQ4ptTeBj4ybK6TPtupsl/JQztSN7jQnjLvGGtxcjWUT6oA3b OUEQJjrn9Ll4cvBHK2AAAJCAVm/3nRwcE6bTgO4QrEFY8xA407eY7bIOH/ASp4oto8LW 0KJrJgJYXZmO1VRoM36NvvafdkVTAeiU9rypYqhRqMU32MW6JilaomjbvhKTQ7LoElrj xXA6DTHcIbeWX+FgsWNKThO/EJaVCN1wj6tuPPSIMZ9saqMUQLm247wRd6ZmWmoVtY32 vHuKnSl3tuYBFAUB8e7DSzFaPWp0coq9OWZkbyd1FmN9K14/jnnl2cchWX/TWTCC9LLH Smag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YGxrlqa8FTYGUSfVMlirKQb9dOlLy2j5nLcGrU15r8g=; b=fQ7tTlABmu4b5GogVNyWqx+V8mZyhDP/splZ+RC9A7jKtQEJQdzCVud8gmDY/WR8NZ ptL1uZWfpoG1WZTgQs/8mjIUxWIF0R5Lo16L9H6UvZeEc7SCRqDZa2l6d013P7x9r3y5 GrJHsmO3UDMCX5Alvvr8zVp5jaqDJN12kbLr58OuqIHp8gzg/CV20WaoyhpIRZK4t7Yw ZlVev1G6YtJ4lJ9vbtfiklwgVzgBS0l5CH+Oeb5Ro2aFCsrltcvVqcinspnkb0LI/Aj3 75mkwJqiQOkvzZnQr3bBmZohl4Qmj2nqSHhPOaagJEnXOk6ZcyRuE1ypI1KWAwBjFvBc l2zQ== X-Gm-Message-State: AFqh2kq+zCoghkjwRBa5KvH5vgd9TaNG4uNRzN88KhKuPw3iYI6t3v4S cTomzAHSxkBnm1fndYFJAB7G6qWyW+0a+PXq X-Google-Smtp-Source: AMrXdXuQ3YI3+MQk2OTy5fr/GcZSRd5+OxvvUYREnzK/xIj5mqkoueGiEBID/DhzYJRyjv4bTtspHQ== X-Received: by 2002:adf:e801:0:b0:242:4f41:4da8 with SMTP id o1-20020adfe801000000b002424f414da8mr5822785wrm.9.1671123766649; Thu, 15 Dec 2022 09:02:46 -0800 (PST) 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 q6-20020adff506000000b0022e57e66824sm7429148wro.99.2022.12.15.09.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:02:46 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 15 Dec 2022 20:02:18 +0300 Message-Id: <20221215170219.3072151-5-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221215170219.3072151-1-odivlad@gmail.com> References: <20221215170219.3072151-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Dumitru Ceara , Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 4/5] ic: minor code improvements 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" 1. Remove excess nbrec_logical_router variable. 2. Remove excess call to add_static_to_routes_ad(). 3. Remove double nexthop check in ic_route_find(). Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- ic/ovn-ic.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 518796149..73ce77e5c 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -895,8 +895,7 @@ ic_route_find(struct hmap *routes, const struct in6_addr *prefix, r->plen == plen && ipv6_addr_equals(&r->nexthop, nexthop) && !strcmp(r->origin, origin) && - !strcmp(r->route_table ? r->route_table : "", route_table) && - ipv6_addr_equals(&r->nexthop, nexthop)) { + !strcmp(r->route_table ? r->route_table : "", route_table)) { return r; } } @@ -1131,17 +1130,8 @@ add_static_to_routes_ad( struct hmap *routes_ad, const struct nbrec_logical_router_static_route *nb_route, const struct lport_addresses *nexthop_addresses, - const struct smap *nb_options, const char *route_table) + const struct smap *nb_options) { - if (strcmp(route_table, nb_route->route_table)) { - if (VLOG_IS_DBG_ENABLED()) { - VLOG_DBG("Skip advertising route %s -> %s as its route table %s !=" - " %s of TS port", nb_route->ip_prefix, nb_route->nexthop, - nb_route->route_table, route_table); - } - return; - } - struct in6_addr prefix, nexthop; unsigned int plen; if (!parse_route(nb_route->ip_prefix, nb_route->nexthop, @@ -1566,10 +1556,10 @@ build_ts_routes_to_adv(struct ic_context *ctx, nbrec_logical_router_update_static_routes_delvalue(lr, nb_route); } - } else { + } else if (!strcmp(ts_route_table, nb_route->route_table)) { /* It may be a route to be advertised */ add_static_to_routes_ad(routes_ad, nb_route, ts_port_addrs, - &nb_global->options, ts_route_table); + &nb_global->options); } } @@ -1602,7 +1592,6 @@ advertise_lr_routes(struct ic_context *ctx, const struct icsbrec_port_binding *isb_pb; const char *lrp_name, *ts_name, *route_table; struct lport_addresses ts_port_addrs; - const struct nbrec_logical_router *lr = ic_lr->lr; const struct icnbrec_transit_switch *key; struct hmap routes_ad = HMAP_INITIALIZER(&routes_ad); @@ -1620,7 +1609,7 @@ advertise_lr_routes(struct ic_context *ctx, VLOG_INFO_RL(&rl, "Route sync ignores port %s on ts %s for router" " %s because the addresses are invalid.", isb_pb->logical_port, isb_pb->transit_switch, - lr->name); + ic_lr->lr->name); continue; } lrp_name = get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port); From patchwork Thu Dec 15 17:02:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1716216 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.133; helo=smtp2.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=JNblY2Xt; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4NXz8S3v36z2403 for ; Fri, 16 Dec 2022 04:03:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A2C7841058; Thu, 15 Dec 2022 17:03:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A2C7841058 Authentication-Results: smtp2.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=JNblY2Xt 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 L29YB4fusDrZ; Thu, 15 Dec 2022 17:03:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id E007B41004; Thu, 15 Dec 2022 17:03:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E007B41004 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8FA83C007C; Thu, 15 Dec 2022 17:03:31 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17CE4C0035 for ; Thu, 15 Dec 2022 17:03:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0E16361041 for ; Thu, 15 Dec 2022 17:02:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0E16361041 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=JNblY2Xt X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wch2g76SwxGh for ; Thu, 15 Dec 2022 17:02:49 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0625661055 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0625661055 for ; Thu, 15 Dec 2022 17:02:49 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id h7so3765243wrs.6 for ; Thu, 15 Dec 2022 09:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kr8G04SBRLBmLUm/7uQgLaHxKIN0jm/v5JE7a720Ra8=; b=JNblY2XteDJQxMWiSCAFViHJfJCTfn5Igm/TrhgFDiM8JxCEDnBXueGnTkybybFWAe wg5cu+RAtiupCGwIbszkKG5NXRUoNEi2Tb5n3goJtr3RwPh4QxA/XR+MWssn2ER7WHwB mKt+R9wkOmfNiysEFmz8/cTYNegL5h1s1FFC7vJD21I8vLzwWpb/aBpspl7ipLzh4ydk +6ScBkbM/arlPE4qHZKwoJMy8OFhINZhJEcTsEYuryKCCIFMeO57vUyC5NpzjocIB8qx 42KXIE2cU57bdOA1HLGy+6Gl15vvziaFUiTIPJJHMIYSI2wRriXzlZ6yW4ekX9wW2yyQ q86w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kr8G04SBRLBmLUm/7uQgLaHxKIN0jm/v5JE7a720Ra8=; b=x0+wGeMAAUulR0kuAEUBUdgnLX367o1/sFGdrarD3SV8QE5ilQIKtwr6cs4WAE9cEP xMl7/0TlZOZHTfKbhjWTf3x7Ir0a5mYiAjkVLcdFt9PW2/Xtu9/Yemscvd5DMq00OOx8 Pu9SycIWx0QBtC9Qj1uurBTlnwaDr4Sqm/Yl+on/gWN4ad7XTe7qU5zOlsDRB31EqoaT hesgUug6cg5CN39A9VrvUMi3owKQGbjKng52AlbVMoYNDzF09nzvt3eE+V3ggPjJdqwk E7neayRn6jQyFgroUicBqsUxMaEYNpX3YEC8oea2xRu5FuvW5OUBYlFfpGbXNCv2mQuB Ol7g== X-Gm-Message-State: ANoB5pnv1Cjtvh8tb+kA8wdsHJ+I9EzqfWIRpfjC/B5dJApjA9chIPRo KfYb6pVl3przSLf6B77Ddi1CMCvxxoWwafXn X-Google-Smtp-Source: AA0mqf7fXaLoitV87vcGG7sVSahkrZz4LvLdKBwNKb31Wr8YJxJBKLMwuUiw7VxP9CuH9NuyFCYWng== X-Received: by 2002:a5d:6304:0:b0:242:736f:d3c5 with SMTP id i4-20020a5d6304000000b00242736fd3c5mr18280714wru.57.1671123768343; Thu, 15 Dec 2022 09:02:48 -0800 (PST) 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 q6-20020adff506000000b0022e57e66824sm7429148wro.99.2022.12.15.09.02.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:02:47 -0800 (PST) From: Vladislav Odintsov To: dev@openvswitch.org Date: Thu, 15 Dec 2022 20:02:19 +0300 Message-Id: <20221215170219.3072151-6-odivlad@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221215170219.3072151-1-odivlad@gmail.com> References: <20221215170219.3072151-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 5/5] ic-sb schema: add index for routes table & document upgrade path 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" Add new uniq index to OVN IC Southbound Route table to prevent same routes installation. Also document ovn-ic upgrade details & note new schema change to known possible duplicate records, which can fail the schema convert. Signed-off-by: Vladislav Odintsov --- Documentation/intro/install/ovn-upgrades.rst | 20 ++++++++++++++++++++ NEWS | 4 ++++ ovn-ic-sb.ovsschema | 6 ++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Documentation/intro/install/ovn-upgrades.rst b/Documentation/intro/install/ovn-upgrades.rst index 4c131987e..d0865ede8 100644 --- a/Documentation/intro/install/ovn-upgrades.rst +++ b/Documentation/intro/install/ovn-upgrades.rst @@ -75,6 +75,20 @@ or if you're using a Linux distribution with systemd:: $ sudo systemctl restart ovn-northd +In case your deployment utilizes OVN Interconnection (OVN IC) functionality, +it is also needed to restart ovn-ic daemons and separately restart ovn-ic +databases. + +You may perform this restart using the ovn-ctl script:: + + $ sudo /usr/share/openvswitch/scripts/ovn-ctl restart_ic + $ sudo /usr/share/openvswitch/scripts/ovn-ctl restart_ic_ovsdb + +or if you're using a Linux distribution with systemd:: + + $ sudo systemctl restart ovn-ic + $ sudo systemctl restart ovn-ic-db + Schema Change ^^^^^^^^^^^^^ @@ -102,6 +116,12 @@ of known impactible schema changes and how to fix when error encountered. $ ovn-sbctl chassis-del +#. Release 22.12: index [transit_switch, availability_zone, route_table, + ip_prefix, nexthop] added for OVN Interconnection Southbound DB table Route. + If there are duplicated records in this table, users are adviced to upgrade + ovn-ic daemons in all availability zones first and after that convert OVS + schema (restart ovn-ic database daemon). + Upgrading OVN Integration ------------------------- diff --git a/NEWS b/NEWS index d46f04943..9e5aae6ce 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,10 @@ OVN v22.12.0 - xx xxx xxxx - Add support for component templates within logical flows and load balancers. - Add support for remote port mirroring (Experimental). + - Add new OVN IC Route table index. This index ensures no duplicate routes + can be advertized. When upgrading to this version user must ensure that + all ovn-ic daemons in all availability zones are upgraded before ovn-ic SB + database schema is converted. OVN v22.09.0 - 16 Sep 2022 -------------------------- diff --git a/ovn-ic-sb.ovsschema b/ovn-ic-sb.ovsschema index 72c9d3f3e..1d60b36d1 100644 --- a/ovn-ic-sb.ovsschema +++ b/ovn-ic-sb.ovsschema @@ -1,7 +1,7 @@ { "name": "OVN_IC_Southbound", - "version": "1.1.0", - "cksum": "2309827842 6784", + "version": "1.1.1", + "cksum": "3684563024 6914", "tables": { "IC_SB_Global": { "columns": { @@ -101,6 +101,8 @@ "external_ids": { "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}}, + "indexes": [["transit_switch", "availability_zone", "route_table", + "ip_prefix", "nexthop"]], "isRoot": true}, "Connection": { "columns": {