From patchwork Wed Jan 24 14:27:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1890300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=NlBdX9f0; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKmX42l05z23dy for ; Thu, 25 Jan 2024 01:28:02 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 19C0D60741; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 19C0D60741 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NlBdX9f0 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 aY9uLw4trFdl; Wed, 24 Jan 2024 14:27:59 +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 1B003606A9; Wed, 24 Jan 2024 14:27:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1B003606A9 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E6B5DC0077; Wed, 24 Jan 2024 14:27:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id AA87FC0037 for ; Wed, 24 Jan 2024 14:27:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7934B81980 for ; Wed, 24 Jan 2024 14:27:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7934B81980 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NlBdX9f0 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 YD7VjR4g-Rwa for ; Wed, 24 Jan 2024 14:27:55 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9DE04817A2 for ; Wed, 24 Jan 2024 14:27:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9DE04817A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706106474; 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: in-reply-to:in-reply-to:references:references; bh=mEq+v8yUWgptC01tqnpnVY8n/eWB+hb89J2mpWJzT6A=; b=NlBdX9f01lojvpU8y8YUHQ7bA09fHJONtFGOz2eV1fTLbvTKSJ9apMtlPsee6ECA+ARhC1 5OXvpc6DVezDZDX0kefNZBIjmWcYuJbdvnjeqiqHZ1xa4WMmTAYv4Lp5QZzOvqIwpdVNUW JZb1kH/FBcGqehHN2vSv/6/C+2zisWE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-wMvf-0dZNd6H8x8MoYl6gg-1; Wed, 24 Jan 2024 09:27:53 -0500 X-MC-Unique: wMvf-0dZNd6H8x8MoYl6gg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC6001C0512B for ; Wed, 24 Jan 2024 14:27:52 +0000 (UTC) Received: from mheiblap.localdomain.com (unknown [10.47.238.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97F4BAC05; Wed, 24 Jan 2024 14:27:51 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Wed, 24 Jan 2024 16:27:37 +0200 Message-Id: <20240124142740.969176-2-mheib@redhat.com> In-Reply-To: <20240124142740.969176-1-mheib@redhat.com> References: <20240124142740.969176-1-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v5 1/4] OVN-IC: Interconnect DBs add basic Information Flow columns. 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 basic flow columns to interconnect northbound DB and interconnect Southbound DB. Those columns will be used by future patches to add basic support for Information Flow in OVN interconnect. Signed-off-by: Mohammad Heib Acked-by: Mark Michelson Acked-by: Ales Musil --- NEWS | 8 ++++++++ ovn-ic-nb.ovsschema | 6 ++++-- ovn-ic-nb.xml | 17 +++++++++++++++++ ovn-ic-sb.ovsschema | 8 +++++--- ovn-ic-sb.xml | 21 +++++++++++++++++++++ 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 5f267b4c6..9762af0e6 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,14 @@ Post v23.09.0 - ovn-northd-ddlog has been removed. - A new LSP option "enable_router_port_acl" has been added to enable conntrack for the router port whose peer is l3dgw_port if set it true. + - OVN Interconnection: + * INB provides basic feedback to the CMS about the ISB changes + handling status. + * IC_NB_Global now have "nb_ic_cfg" and "sb_ic_cfg" columns for + for ISB informational status. + * IC_SB_Global now have "nb_ic_cfg" column for ISB informational status. + * Availability_Zone now have "nb_ic_cfg" column for local AZ + informational status. OVN v23.09.0 - 15 Sep 2023 -------------------------- diff --git a/ovn-ic-nb.ovsschema b/ovn-ic-nb.ovsschema index 894db8344..bee174357 100644 --- a/ovn-ic-nb.ovsschema +++ b/ovn-ic-nb.ovsschema @@ -1,10 +1,12 @@ { "name": "OVN_IC_Northbound", - "version": "1.0.0", - "cksum": "45589876 3383", + "version": "1.1.0", + "cksum": "3964083684 3501", "tables": { "IC_NB_Global": { "columns": { + "nb_ic_cfg": {"type": {"key": "integer"}}, + "sb_ic_cfg": {"type": {"key": "integer"}}, "external_ids": { "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}, diff --git a/ovn-ic-nb.xml b/ovn-ic-nb.xml index 8c53bec3b..2ae9bf6d5 100644 --- a/ovn-ic-nb.xml +++ b/ovn-ic-nb.xml @@ -36,6 +36,23 @@ one row.

+ + These columns allow a client to track the overall configuration state of + the system. + + + Sequence number for client to increment. When a client modifies the + interconnect northbound database configuration and wishes to wait for + OVN-ICs to handle this change and update the Interconnect + southbound database, it may increment this sequence number. + + + Sequence number that one OVN-IC sets to the value of + after waiting to all the OVN-ICs + finish applying their changes to interconnect southbound database. + + + See External IDs at the beginning of this document. diff --git a/ovn-ic-sb.ovsschema b/ovn-ic-sb.ovsschema index 1d60b36d1..5baf141cf 100644 --- a/ovn-ic-sb.ovsschema +++ b/ovn-ic-sb.ovsschema @@ -1,10 +1,11 @@ { "name": "OVN_IC_Southbound", - "version": "1.1.1", - "cksum": "3684563024 6914", + "version": "1.2.0", + "cksum": "1381014956 7032", "tables": { "IC_SB_Global": { "columns": { + "nb_ic_cfg": {"type": {"key": "integer"}}, "external_ids": { "type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}}, @@ -24,7 +25,8 @@ "isRoot": true}, "Availability_Zone": { "columns": { - "name": {"type": "string"}}, + "name": {"type": "string"}, + "nb_ic_cfg": {"type": {"key": "integer"}}}, "isRoot": true, "indexes": [["name"]]}, "Gateway": { diff --git a/ovn-ic-sb.xml b/ovn-ic-sb.xml index f7e17e113..c3e7d2173 100644 --- a/ovn-ic-sb.xml +++ b/ovn-ic-sb.xml @@ -69,6 +69,21 @@ one row.

+ + This column allow a client to track the overall configuration state of + the system. + + + Sequence number for the configuration. When a CMS or + ovn-ic-nbctl updates the Interconnect northbound database, + it increments the nb_ic_cfg column in the + NB_IC_Global table in the Interconnect northbound + database. when OVN-ICs updates the southbound database to + bring it up to date with these changes, one OVN-IC updates + this column to the same value. + + + See External IDs at the beginning of this document. @@ -102,6 +117,12 @@ A name that uniquely identifies the availability zone. + + + This column is used by the OVN-IC to inform + that this IC instance is aligned with the changes in INB + + From patchwork Wed Jan 24 14:27:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1890303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=ZNl+IBhY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKmX954bdz23dy for ; Thu, 25 Jan 2024 01:28:09 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id BF40A410B5; Wed, 24 Jan 2024 14:28:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BF40A410B5 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZNl+IBhY 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 gxmp9ztX1bWO; Wed, 24 Jan 2024 14:28:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4792640554; Wed, 24 Jan 2024 14:28:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4792640554 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 828EFC0DDA; Wed, 24 Jan 2024 14:28:00 +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 8EF88C0037 for ; Wed, 24 Jan 2024 14:27:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4D34A6068A for ; Wed, 24 Jan 2024 14:27:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4D34A6068A Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZNl+IBhY 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 EmjIVjWhgylT for ; Wed, 24 Jan 2024 14:27:57 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 753566068F for ; Wed, 24 Jan 2024 14:27:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 753566068F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706106475; 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: in-reply-to:in-reply-to:references:references; bh=PKGFRcNbfyn0SZVdkgCWjUiUm8HZpzMF8nDlq0lclo4=; b=ZNl+IBhYuonIjkVC4QUE71OJA1GJIkO3HKgssjzmaRbZV5sM7gKNX5DjMUQIB0dLe85gZI 8eujy7EJBDNvC07HWgDw+Z8JxEtoqd+2b6LhxRWF26WUJaPu8lwJHjPfahpgz+DlB2GRqd 5dtIdqpm552Jb2PDqQXMit4TPTPO+Cw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-281-fB1rbwDKN5qSn93WLKFovw-1; Wed, 24 Jan 2024 09:27:54 -0500 X-MC-Unique: fB1rbwDKN5qSn93WLKFovw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 29E861C068CF for ; Wed, 24 Jan 2024 14:27:54 +0000 (UTC) Received: from mheiblap.localdomain.com (unknown [10.47.238.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AE5FABFC; Wed, 24 Jan 2024 14:27:52 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Wed, 24 Jan 2024 16:27:38 +0200 Message-Id: <20240124142740.969176-3-mheib@redhat.com> In-Reply-To: <20240124142740.969176-2-mheib@redhat.com> References: <20240124142740.969176-1-mheib@redhat.com> <20240124142740.969176-2-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v5 2/4] ovn-ic: Implement basic INB change handling status. 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" This patch implements a basic sequence number protocol that can be used by CMS to determine if the changes applied to INB are successfully propagated to ISB. The implementation of this patch relies on OVN-ICs instances to update the ISB by adding a per AZ a nb_ic_cfg counter that will be updated by the OVN-IC once it is done and commit all needed changes to the ISB, and according to this AZ:nb_ic_cfg the ISB and INB will be updating about the status of the changes. Signed-off-by: Mohammad Heib Acked-by: Ales Musil --- ic/ovn-ic.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 5 deletions(-) diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 8ceb34d7c..d0b58d4d1 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1782,16 +1782,95 @@ route_run(struct ic_context *ctx, hmap_destroy(&ic_lrs); } +/* + * This function implements a sequence number protocol that can be used by + * the INB end user to verify that ISB is synced with all the changes that + * are done be the user/AZs-controllers: + * + * Since we have multiple IC instances running in different regions + * we can't rely on one of them to update the ISB and sync that update + * to INB since other ICs can make changes in parallel. + * So to have a sequence number protocol working properly we must + * make sure that all the IC instances are synced with the ISB first + * and then update the INB. + * + * To guarantee that all instances are synced with ISB first, each IC + * will do the following steps: + * + * 1. when local ovn-ic sees that INB:nb_ic_cfg has updated we will set + * the ic_sb_loop->next_cfg to match the INB:nb_ic_cfg and increment + * the value of AZ:nb_ic_cfg and wait until we get confirmation from + * the server. + * + * 2. once this IC instance changes for ISB are committed successfully + * (next loop), the value of cur_cfg will be updated to match + * the INB:nb_ic_cfg that indicate that our local instance is up to date + * and no more changes need to be done for ISB. + * + * 3. validate that the AZ:nb_ic_cfg to match the INB:nb_ic_cfg. + * + * 4. Go through all the AZs and check if all have the same value of + * AZ:nb_ic_cfg that means all the AZs are done with ISB changes and ISB are + * up to date with INB, so we can set the values of ISB:nb_ic_cfg to + * INB:nb_ic_cfg and INB:sb_ic_cfg to INB:nb_ic_cfg. + */ static void -ovn_db_run(struct ic_context *ctx) +update_sequence_numbers(const struct icsbrec_availability_zone *az, + struct ic_context *ctx, + struct ovsdb_idl_loop *ic_sb_loop) { - const struct icsbrec_availability_zone *az = az_run(ctx); - VLOG_DBG("Availability zone: %s", az ? az->name : "not created yet."); + if (!ctx->ovnisb_txn || !ctx->ovninb_txn) { + return; + } + + const struct icnbrec_ic_nb_global *ic_nb = icnbrec_ic_nb_global_first( + ctx->ovninb_idl); + if (!ic_nb) { + ic_nb = icnbrec_ic_nb_global_insert(ctx->ovninb_txn); + } + const struct icsbrec_ic_sb_global *ic_sb = icsbrec_ic_sb_global_first( + ctx->ovnisb_idl); + if (!ic_sb) { + ic_sb = icsbrec_ic_sb_global_insert(ctx->ovnisb_txn); + } - if (!az) { + if ((ic_nb->nb_ic_cfg != ic_sb->nb_ic_cfg) && + (ic_nb->nb_ic_cfg != az->nb_ic_cfg)) { + /* Deal with potential overflows. */ + if (az->nb_ic_cfg == LLONG_MAX) { + icsbrec_availability_zone_set_nb_ic_cfg(az, 0); + } + ic_sb_loop->next_cfg = ic_nb->nb_ic_cfg; + ovsdb_idl_txn_increment(ctx->ovnisb_txn, &az->header_, + &icsbrec_availability_zone_col_nb_ic_cfg, true); return; } + /* handle cases where accidentally AZ:ic_nb_cfg exceeds + * the INB:ic_nb_cfg. + */ + if (az->nb_ic_cfg != ic_sb_loop->cur_cfg) { + icsbrec_availability_zone_set_nb_ic_cfg(az, ic_sb_loop->cur_cfg); + return; + } + + const struct icsbrec_availability_zone *other_az; + ICSBREC_AVAILABILITY_ZONE_FOR_EACH (other_az, ctx->ovnisb_idl) { + if (other_az->nb_ic_cfg != az->nb_ic_cfg) { + return; + } + } + /* All the AZs are updated successfully, update SB/NB counter. */ + if (ic_nb->nb_ic_cfg != ic_sb->nb_ic_cfg) { + icsbrec_ic_sb_global_set_nb_ic_cfg(ic_sb, az->nb_ic_cfg); + icnbrec_ic_nb_global_set_sb_ic_cfg(ic_nb, az->nb_ic_cfg); + } +} + +static void +ovn_db_run(struct ic_context *ctx, + const struct icsbrec_availability_zone *az) +{ ts_run(ctx); gateway_run(ctx, az); port_binding_run(ctx, az); @@ -2218,7 +2297,13 @@ main(int argc, char *argv[]) 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); + const struct icsbrec_availability_zone *az = az_run(&ctx); + VLOG_DBG("Availability zone: %s", az ? az->name : + "not created yet."); + if (az) { + ovn_db_run(&ctx, az); + update_sequence_numbers(az, &ctx, &ovnisb_idl_loop); + } } int rc1 = ovsdb_idl_loop_commit_and_wait(&ovnnb_idl_loop); From patchwork Wed Jan 24 14:27:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1890304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=WjFg/u1W; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKmXB4wq4z23g5 for ; Thu, 25 Jan 2024 01:28:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id EA04C830C5; Wed, 24 Jan 2024 14:28:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org EA04C830C5 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WjFg/u1W 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 G-1PayIxOyAY; Wed, 24 Jan 2024 14:28:06 +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 27D9982F8A; Wed, 24 Jan 2024 14:28:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 27D9982F8A Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1837BC0DDD; Wed, 24 Jan 2024 14:28:03 +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 535ABC0DD4 for ; Wed, 24 Jan 2024 14:28:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0F7B941A66 for ; Wed, 24 Jan 2024 14:28:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 0F7B941A66 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WjFg/u1W 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 HrKfTmUehzcK for ; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 94E7E408B0 for ; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 94E7E408B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706106479; 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: in-reply-to:in-reply-to:references:references; bh=SGjBYtUvu5oCQEZdfJQfNeu0yYKWz7xxaUYtWlAMzLY=; b=WjFg/u1Wz6GW0CY/tXJK6/CcEu+EIOrTEtwz2aRFnlr5S0fLUfpDKpcHnz+Ic/xAuBOz71 VnsZGqOvq6xf0asJGpeVlA5U0zqL3K1tF7dtz0pNVqlsw9JZiRT9sqLWxrL/VK+HOfggjL MqWJeZt/KF3V4XfEq9usV0zEC/G+ueE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-YgatkcmbOdSnDQkTV89IIQ-1; Wed, 24 Jan 2024 09:27:56 -0500 X-MC-Unique: YgatkcmbOdSnDQkTV89IIQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5CDC88B7A3 for ; Wed, 24 Jan 2024 14:27:55 +0000 (UTC) Received: from mheiblap.localdomain.com (unknown [10.47.238.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89FC6ABFC; Wed, 24 Jan 2024 14:27:54 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Wed, 24 Jan 2024 16:27:39 +0200 Message-Id: <20240124142740.969176-4-mheib@redhat.com> In-Reply-To: <20240124142740.969176-3-mheib@redhat.com> References: <20240124142740.969176-1-mheib@redhat.com> <20240124142740.969176-2-mheib@redhat.com> <20240124142740.969176-3-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v5 3/4] OVN-IC: Make it possible for CMS to detect when the ISB is up-to-date. 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" Until now, there has been no reliable for the CMS to detect when changes made to the INB configuration have been passed through to the ISB, This commit adds this feature to the system, by adding sequence numbers to the INB and ISB and adding code in ovn-ic-nbctl, ovn-ic to keep those sequence numbers up-to-date. The biggest user-visible change from this commit is a new option '--wait' and new command 'sync' to ovn-ic-nbctl. With --wait=sb, ovn-ic-nbctl now waits for ovn-ics to update the ISB database. Signed-off-by: Mohammad Heib Acked-by: Mark Michelson Acked-by: Ales Musil --- utilities/ovn-ic-nbctl.8.xml | 49 ++++++++++++++++++++ utilities/ovn-ic-nbctl.c | 86 +++++++++++++++++++++++++++++++++++- 2 files changed, 133 insertions(+), 2 deletions(-) diff --git a/utilities/ovn-ic-nbctl.8.xml b/utilities/ovn-ic-nbctl.8.xml index 4a70994b8..5a1324d2d 100644 --- a/utilities/ovn-ic-nbctl.8.xml +++ b/utilities/ovn-ic-nbctl.8.xml @@ -123,9 +123,58 @@ +

Synchronization Commands

+ +
+
sync
+
+ Ordinarily, --wait=sb only waits for changes by the + current ovn-ic-nbctl invocation to take effect. + This means that, if none of the commands supplied to + ovn-ic-nbctl change the database, then the command does + not wait at all. With the sync command, however, + ovn-ic-nbctl waits even for earlier changes to the + database to propagate down to the southbound database, according to the + argument of --wait. +
+
+

Options

+
--no-wait | --wait=none
+
--wait=sb
+ +
+

+ These options control whether and how ovn-ic-nbctl waits + for the OVN system to become up-to-date with changes made in an + ovn-ic-nbctl invocation. +

+ +

+ By default, or if --no-wait or --wait=none, + ovn-ic-nbctl exits immediately after confirming that + changes have been committed to the Interconnect northbound database, + without waiting. +

+ +

+ With --wait=sb, before ovn-ic-nbctl exits, + it waits for ovn-ics to bring the Interconnect + southbound database up-to-date with the Interconnect northbound + database updates. +

+ +

+ Ordinarily, --wait=sb only waits for changes by the + current ovn-ic-nbctl invocation to take effect. + This means that, if none of the commands supplied to + ovn-ic-nbctl change the database, then the command + does not wait at all. + Use the sync command to override this behavior. +

+
--db database
The OVSDB database remote to contact. If the OVN_IC_NB_DB diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c index 721dc4586..4317c385a 100644 --- a/utilities/ovn-ic-nbctl.c +++ b/utilities/ovn-ic-nbctl.c @@ -58,6 +58,13 @@ static bool oneline; /* --dry-run: Do not commit any changes. */ static bool dry_run; +/* --wait=TYPE: Wait for configuration change to take effect? */ +static enum nbctl_wait_type wait_type = NBCTL_WAIT_NONE; + +/* Should we wait (if specified by 'wait_type') even if the commands don't + * change the database at all */ +static bool force_wait = false; + /* --timeout: Time to wait for a connection to 'db'. */ static unsigned int timeout; @@ -161,6 +168,8 @@ parse_options(int argc, char *argv[], struct shash *local_options) OPT_DB = UCHAR_MAX + 1, OPT_ONELINE, OPT_NO_SYSLOG, + OPT_NO_WAIT, + OPT_WAIT, OPT_DRY_RUN, OPT_LOCAL, OPT_COMMANDS, @@ -173,6 +182,8 @@ parse_options(int argc, char *argv[], struct shash *local_options) static const struct option global_long_options[] = { {"db", required_argument, NULL, OPT_DB}, {"no-syslog", no_argument, NULL, OPT_NO_SYSLOG}, + {"no-wait", no_argument, NULL, OPT_NO_WAIT}, + {"wait", required_argument, NULL, OPT_WAIT}, {"dry-run", no_argument, NULL, OPT_DRY_RUN}, {"oneline", no_argument, NULL, OPT_ONELINE}, {"timeout", required_argument, NULL, 't'}, @@ -234,7 +245,19 @@ parse_options(int argc, char *argv[], struct shash *local_options) case OPT_DRY_RUN: dry_run = true; break; - + case OPT_NO_WAIT: + wait_type = NBCTL_WAIT_NONE; + break; + case OPT_WAIT: + if (!strcmp(optarg, "none")) { + wait_type = NBCTL_WAIT_NONE; + } else if (!strcmp(optarg, "sb")) { + wait_type = NBCTL_WAIT_SB; + } else { + ctl_fatal("argument to --wait must be " + "\"none\", \"sb\" "); + } + break; case OPT_LOCAL: if (shash_find(local_options, options[idx].name)) { ctl_fatal("'%s' option specified multiple times", @@ -329,9 +352,14 @@ set the SSL configuration\n\ %s\ %s\ \n\ +Synchronization command (use with --wait=sb):\n\ + sync wait even for earlier changes to take effect\n\ +\n\ Options:\n\ --db=DATABASE connect to DATABASE\n\ (default: %s)\n\ + --no-wait, --wait=none do not wait for OVN reconfiguration (default)\n\ + --wait=sb wait for southbound database update\n\ --no-leader-only accept any cluster member, not just the leader\n\ -t, --timeout=SECS wait at most SECS seconds\n\ --dry-run do not commit changes to database\n\ @@ -380,6 +408,12 @@ ic_nbctl_init(struct ctl_context *ctx OVS_UNUSED) { } +static void +ic_nbctl_pre_sync(struct ctl_context *base OVS_UNUSED) +{ + force_wait = true; +} + static void ic_nbctl_ts_add(struct ctl_context *ctx) { @@ -705,6 +739,33 @@ ic_nbctl_context_done_command(struct ic_nbctl_context *ic_nbctl_ctx, ctl_context_done_command(&ic_nbctl_ctx->base, command); } +static void +ic_nbctl_validate_sequence_numbers(int expected_cfg, + struct ovsdb_idl *idl) +{ + if (wait_type == NBCTL_WAIT_NONE) { + if (force_wait) { + VLOG_INFO("\"sync\" command has no effect without --wait"); + } + return; + } + + const struct icnbrec_ic_nb_global *inb = icnbrec_ic_nb_global_first(idl); + ovsdb_idl_enable_reconnect(idl); + for (;;) { + ovsdb_idl_run(idl); + ICNBREC_IC_NB_GLOBAL_FOR_EACH (inb, idl) { + int64_t cur_cfg = inb->sb_ic_cfg; + int64_t delta = cur_cfg - expected_cfg; + if (cur_cfg >= expected_cfg && delta < INT32_MAX) { + return; + } + } + ovsdb_idl_wait(idl); + poll_block(); + } +} + static void ic_nbctl_context_done(struct ic_nbctl_context *ic_nbctl_ctx, struct ctl_command *command) @@ -748,6 +809,7 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, struct ic_nbctl_context ic_nbctl_ctx; struct ctl_command *c; struct shash_node *node; + int64_t next_cfg = 0; txn = the_idl_txn = ovsdb_idl_txn_create(idl); if (dry_run) { @@ -762,6 +824,17 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, icnbrec_ic_nb_global_insert(txn); } + if (wait_type != NBCTL_WAIT_NONE) { + + /* Deal with potential overflows. */ + if (inb->nb_ic_cfg == LLONG_MAX) { + icnbrec_ic_nb_global_set_nb_ic_cfg(inb, 0); + } + ovsdb_idl_txn_increment(txn, &inb->header_, + &icnbrec_ic_nb_global_col_nb_ic_cfg, + force_wait); + } + symtab = ovsdb_symbol_table_create(); for (c = commands; c < &commands[n_commands]; c++) { ds_init(&c->output); @@ -807,6 +880,10 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, } status = ovsdb_idl_txn_commit_block(txn); + if (wait_type != NBCTL_WAIT_NONE && status == TXN_SUCCESS) { + next_cfg = ovsdb_idl_txn_get_increment_new_value(txn); + } + if (status == TXN_UNCHANGED || status == TXN_SUCCESS) { for (c = commands; c < &commands[n_commands]; c++) { if (c->syntax->postprocess) { @@ -884,6 +961,11 @@ do_ic_nbctl(const char *args, struct ctl_command *commands, size_t n_commands, shash_destroy_free_data(&c->options); } free(commands); + + if (status != TXN_UNCHANGED) { + ic_nbctl_validate_sequence_numbers(next_cfg, idl); + } + ovsdb_idl_txn_destroy(txn); ovsdb_idl_destroy(idl); @@ -924,7 +1006,7 @@ ic_nbctl_exit(int status) static const struct ctl_command_syntax ic_nbctl_commands[] = { { "init", 0, 0, "", NULL, ic_nbctl_init, NULL, "", RW }, - + { "sync", 0, 0, "", ic_nbctl_pre_sync, NULL, NULL, "", RO }, /* transit switch commands. */ { "ts-add", 1, 1, "SWITCH", NULL, ic_nbctl_ts_add, NULL, "--may-exist", RW }, { "ts-del", 1, 1, "SWITCH", NULL, ic_nbctl_ts_del, NULL, "--if-exists", RW }, From patchwork Wed Jan 24 14:27:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1890302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=eUhyF51m; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKmX82Rz3z23dy for ; Thu, 25 Jan 2024 01:28:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E83A982F76; Wed, 24 Jan 2024 14:28:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E83A982F76 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eUhyF51m 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 u3Cxhy1WbOXX; Wed, 24 Jan 2024 14:28:04 +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 87F988208A; Wed, 24 Jan 2024 14:28:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 87F988208A Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 713E4C0DD4; Wed, 24 Jan 2024 14:28:02 +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 9F5E9C0DDB for ; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 76B6281E92 for ; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 76B6281E92 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 knyN67Tinstd for ; Wed, 24 Jan 2024 14:28:00 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id CA84F81E7E for ; Wed, 24 Jan 2024 14:27:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CA84F81E7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706106478; 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: in-reply-to:in-reply-to:references:references; bh=M0uVR8rv/e5u4GmysOKLOvI42gP8rCes+nbEvXwnOM8=; b=eUhyF51mQoh0w/ioa1pkolLyDjwy50cFqrwu99RzHvc9oTjqdjgS/lKWxJvo7FWFTDc4h0 7mwSBcFj/AsLe/LFWeQDMyyPeRiP2cEIMd/KLBJjnLTaXirmQVU4xyrBgrMLfyKiZGL/Da l3PUccKaUuHTm48cAmYvZ0XnJiy5V3k= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-INKr5t-ZOJmSBc0P440Mhg-1; Wed, 24 Jan 2024 09:27:57 -0500 X-MC-Unique: INKr5t-ZOJmSBc0P440Mhg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2660C1C068CE for ; Wed, 24 Jan 2024 14:27:57 +0000 (UTC) Received: from mheiblap.localdomain.com (unknown [10.47.238.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31595ABFC; Wed, 24 Jan 2024 14:27:55 +0000 (UTC) From: Mohammad Heib To: dev@openvswitch.org Date: Wed, 24 Jan 2024 16:27:40 +0200 Message-Id: <20240124142740.969176-5-mheib@redhat.com> In-Reply-To: <20240124142740.969176-4-mheib@redhat.com> References: <20240124142740.969176-1-mheib@redhat.com> <20240124142740.969176-2-mheib@redhat.com> <20240124142740.969176-3-mheib@redhat.com> <20240124142740.969176-4-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v5 4/4] ic/tests: Add unit test for ic sync command. 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 unit test that check validate that sync command sync ISB properly Signed-off-by: Mohammad Heib Acked-by: Ales Musil --- tests/ovn-ic.at | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index d4c436f84..535aba7da 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -1274,3 +1274,46 @@ OVN_CLEANUP_IC([az1], [az2]) AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD([ +AT_SETUP([ovn-ic -- sync ISB status to INB]) +ovn_init_ic_db +net_add n1 + +ovn_start az1 +sim_add gw-az1 +as gw-az1 + +check ovs-vsctl add-br br-phys +ovn_az_attach az1 n1 br-phys 192.168.1.1 +check ovs-vsctl set open . external-ids:ovn-is-interconn=true +as az1 + +# pause ovn-ic instance +check ovn-appctl -t ic/ovn-ic pause + +# run sync command in the background this commands +# supposed to stuck since ovn-ic is paused. +ovn-ic-nbctl --wait=sb sync & + +OVS_WAIT_UNTIL([test $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg) -gt $(ovn-ic-nbctl get ic_nb_global . sb_ic_cfg)]) +AT_CHECK([ovn-ic-nbctl get ic_nb_global . nb_ic_cfg], [0], [dnl +1 +]) +AT_CHECK([ovn-ic-nbctl get ic_nb_global . sb_ic_cfg], [0], [dnl +0 +]) + +# resume ovn-ic instance +check ovn-appctl -t ic/ovn-ic resume +OVS_WAIT_UNTIL([test $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg) -eq $(ovn-ic-nbctl get ic_nb_global . sb_ic_cfg)]) +AT_CHECK([ovn-ic-nbctl get ic_nb_global . nb_ic_cfg], [0], [dnl +1 +]) +AT_CHECK([ovn-ic-nbctl get ic_nb_global . sb_ic_cfg], [0], [dnl +1 +]) + +OVN_CLEANUP_IC([az1]) +AT_CLEANUP +])