From patchwork Mon Aug 30 19:57:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1522326 X-Patchwork-Delegate: zhouhan@gmail.com 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::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=20161025 header.b=jH64+3sU; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 4Gz1Lp72z4z9sW4 for ; Tue, 31 Aug 2021 05:57:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0D65E4013C; Mon, 30 Aug 2021 19:57:19 +0000 (UTC) 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 iy-QYxiya3FY; Mon, 30 Aug 2021 19:57:15 +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 2019C40105; Mon, 30 Aug 2021 19:57:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E9E12C0010; Mon, 30 Aug 2021 19:57:13 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id CEC01C000E for ; Mon, 30 Aug 2021 19:57:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B19DF40338 for ; Mon, 30 Aug 2021 19:57:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com 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 MxsDpt5Ht_VH for ; Mon, 30 Aug 2021 19:57:12 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by smtp4.osuosl.org (Postfix) with ESMTPS id 0FB7040309 for ; Mon, 30 Aug 2021 19:57:11 +0000 (UTC) Received: by mail-ej1-x632.google.com with SMTP id me10so33614401ejb.11 for ; Mon, 30 Aug 2021 12:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DEH1yfy75avjI7ZoA7x7nLV4b2h0i04rh1/vh8ZewgM=; b=jH64+3sUj9GLlFpIeAZvpHSqaG1OR7hp5jWO8N+3SR5Mdzpwxt//bsOknWtW95Ejbj zNAvc2mRFRZs4vT869snkP7IgKmxQkGUvhBSmtE+smHnvXyVGtFMOVrvvJ2RJRXZ4KPL igWUXdGwIhkItHxXtAlKMw688kPEBbWDuqwx2Vtrt98Q5wW6HkGMu1hlbaGPHUcgvS7b aHed1lzRmpSopyuJEOo1Gfj2MG2gNmYw4GXpH1ty9CBwVlObz3wNNL3d9m/nLULJ3gkJ ZwFujPQEoNh7Dk8sy7reOV/tNsOnoGom1HzJPMvufHytVB7s65GuBTUPLsm8mtTLAZek 6zbA== 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=DEH1yfy75avjI7ZoA7x7nLV4b2h0i04rh1/vh8ZewgM=; b=D1LhT7jxh+Dw6WJzIPhDrrvl7Yvx3kJ7WPsj3ueLLslhBlJ1TBolOLwQDeVFKm1u04 zbvHxp2bPendXOipRJmru+p3QK0nulJBbxBXJWA9lUOUxx8B9ZViDXtuzY89aSojQabY CrJ+OH+vZ9pScZxHunQ96KeippKRn3HBQFIJox/NJEXO3R+iebudz2/djMZmEa024Ukj nJzfKi7sVkqLpQaMwmQpcwq4oxmRdHLIV/+pNvruWv8MRcAXZKqSsvNP1GZB+Ef6c+2g CNThRHvHbrwOy1NWm69U4cnYSNkkuehw+Sneto6HfLV1ngkrf/8WbSU3vN4COLpEffJl wb2w== X-Gm-Message-State: AOAM532QzvJ4m8qXsPund9EzXsUsLlqhUmT+2N7wobFaGTxFyDvY2Y8f i/A/xnM5/TmiYMqA4dFPWomEHj4pBbE= X-Google-Smtp-Source: ABdhPJyZv4A1z9WAq6ndpBtaCNIw5hkvawtPZRLQH2ZilxJh5nrKeRp8x+HWGiU5g//KqpENtN+Afg== X-Received: by 2002:a17:906:7848:: with SMTP id p8mr26138136ejm.212.1630353430080; Mon, 30 Aug 2021 12:57:10 -0700 (PDT) Received: from localhost.localdomain ([85.187.18.241]) by smtp.gmail.com with ESMTPSA id c17sm8221441edu.11.2021.08.30.12.57.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Aug 2021 12:57:09 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Mon, 30 Aug 2021 22:57:07 +0300 Message-Id: <20210830195707.98529-1-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Cc: Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn] ic: call ovn_db_run() only when all DBs are connected 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" Prior to this commit ovn_db_run() function in ovn-ic was called right after daemon's lock was acquired in SB DB. Inside ovn_db_run() there is a search for availability zone in NB DB. If AZ was not found, ovn_db_run returned. So, it was an implicit requirement for connected NB DB. But in case, where NB DB was connected and ICNB DB was not, we could run in situation where in ts_run() logical switches from NB DB were collected and transit switches from ICNB DB were not due to not synced ICNB DB. This lead to deletion of transit logical switches from NB DB. A normal restart of only one ovn-ic daemon in AZ, could damage the logical topology: it removed LS (transit), its LSPs. After ovn-ic is connected to ICNB, it creates logical switch in NB DB back, but its LSPs are lost and need manual re-addition. This commit adds explicit requirement for all DBs to be connected: - NB DB - SB DB - ICNB DB - ICSB DB Only when this condition is met, we can safely run ovn-ic sync logic. Signed-off-by: Vladislav Odintsov --- ic/ovn-ic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 18066a305..fc608af82 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1786,7 +1786,11 @@ main(int argc, char *argv[]) state.had_lock = false; } - if (ovsdb_idl_has_lock(ovnsb_idl_loop.idl)) { + if (ovsdb_idl_has_lock(ovnsb_idl_loop.idl) && + ovsdb_idl_has_ever_connected(ctx.ovnnb_idl) && + ovsdb_idl_has_ever_connected(ctx.ovnsb_idl) && + ovsdb_idl_has_ever_connected(ctx.ovninb_idl) && + ovsdb_idl_has_ever_connected(ctx.ovnisb_idl)) { ovn_db_run(&ctx); }