From patchwork Tue Jan 9 13:28:51 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Mohammad Heib
X-Patchwork-Id: 1884468
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=caQGjWiU;
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 4T8Wx71HjYz1yP7
for ; Wed, 10 Jan 2024 00:29:15 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id 0BBCD41BBA;
Tue, 9 Jan 2024 13:29:13 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0BBCD41BBA
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=caQGjWiU
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 3rdBINrYcyyh; Tue, 9 Jan 2024 13:29:11 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org
[IPv6:2605:bc80:3010:104::8cd3:938])
by smtp4.osuosl.org (Postfix) with ESMTPS id D06AE41B51;
Tue, 9 Jan 2024 13:29:10 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D06AE41B51
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id BAD9DC0DD2;
Tue, 9 Jan 2024 13:29:09 +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 7D5F4C0037
for ; Tue, 9 Jan 2024 13:29:08 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id 3FD5B410BA
for ; Tue, 9 Jan 2024 13:29:08 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 3FD5B410BA
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 MYJJF3-21Kz3 for ;
Tue, 9 Jan 2024 13:29:07 +0000 (UTC)
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
by smtp4.osuosl.org (Postfix) with ESMTPS id 6459B40926
for ; Tue, 9 Jan 2024 13:29:07 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6459B40926
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1704806946;
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=rZlk7At0nM4vftI0TDUrVQmomAhvFhoFdlzcDjqkTEI=;
b=caQGjWiUQEZ2axYh+L6O5f6eLM8EJdT5Vgd9/CFCPfAPK9AEVGPi4zdDFxnpWW6d5ePUwf
9knR4a1grFISAxMH0iGfOWzl+/s1I6zecjRnljYYwqgWwMB2DHwGW1UyG9QEBsozackt6M
NnD3H3t7l5phjlOJvc6H4FDitcThxFQ=
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-355-xn1kAe_5PeafErgEM16OIw-1; Tue,
09 Jan 2024 08:29:05 -0500
X-MC-Unique: xn1kAe_5PeafErgEM16OIw-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
(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 F25223804521
for ; Tue, 9 Jan 2024 13:29:04 +0000 (UTC)
Received: from mheiblap.localdomain (unknown [10.47.238.59])
by smtp.corp.redhat.com (Postfix) with ESMTP id 019282166B32;
Tue, 9 Jan 2024 13:29:03 +0000 (UTC)
From: Mohammad Heib
To: dev@openvswitch.org
Date: Tue, 9 Jan 2024 15:28:51 +0200
Message-Id: <20240109132854.669822-2-mheib@redhat.com>
In-Reply-To: <20240109132854.669822-1-mheib@redhat.com>
References: <20240109132854.669822-1-mheib@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Subject: [ovs-dev] [PATCH ovn v4 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 20df92cb7..23609957c 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,14 @@ Post v23.09.0
- Support CIDR based MAC binding aging threshold. See ovn-nb(5) for
'mac_binding_age_threshold' for more details.
- ovn-northd-ddlog has been removed.
+ - 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 Tue Jan 9 13:28:52 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Mohammad Heib
X-Patchwork-Id: 1884469
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=d5yaLXoQ;
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 4T8WxB2q6Cz1yP7
for ; Wed, 10 Jan 2024 00:29:18 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1])
by smtp1.osuosl.org (Postfix) with ESMTP id F412E8238C;
Tue, 9 Jan 2024 13:29:14 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F412E8238C
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=d5yaLXoQ
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 WUrYRVZ0ucDv; Tue, 9 Jan 2024 13:29:13 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp1.osuosl.org (Postfix) with ESMTPS id 23F6681E3D;
Tue, 9 Jan 2024 13:29:12 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 23F6681E3D
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 5B76AC0DDA;
Tue, 9 Jan 2024 13:29:10 +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 417FEC0077
for ; Tue, 9 Jan 2024 13:29:09 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp1.osuosl.org (Postfix) with ESMTP id 1DEB481E9C
for ; Tue, 9 Jan 2024 13:29:09 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1DEB481E9C
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 wy3AiM69kk6k for ;
Tue, 9 Jan 2024 13:29:08 +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 4C6C081C46
for ; Tue, 9 Jan 2024 13:29:08 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4C6C081C46
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1704806947;
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=J/F7wFwWn+Teq7ezw+gcEzM5rea2PFtLt93eSpRfIJ8=;
b=d5yaLXoQqmOWnaJmkW3CG0CIkYcXmEf8xwEQPbVde5u/0KKdPNIl0O7g7p43tIXOmV5SjH
g8CA5LQTVt/mv8DEXBJIXiGOI7l5BWSEdm2qMm29uF/3cSsJEfmIZq/1wRqOlWJbryWwvI
6E+tl4uwc7DNC5w6r6H1uCTklh0U0tI=
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-627-n1Ye7_nrNBmYeQecYV4ITQ-1; Tue,
09 Jan 2024 08:29:06 -0500
X-MC-Unique: n1Ye7_nrNBmYeQecYV4ITQ-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
(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 ED61F3C02B98
for ; Tue, 9 Jan 2024 13:29:05 +0000 (UTC)
Received: from mheiblap.localdomain (unknown [10.47.238.59])
by smtp.corp.redhat.com (Postfix) with ESMTP id 4B69C2166B32;
Tue, 9 Jan 2024 13:29:05 +0000 (UTC)
From: Mohammad Heib
To: dev@openvswitch.org
Date: Tue, 9 Jan 2024 15:28:52 +0200
Message-Id: <20240109132854.669822-3-mheib@redhat.com>
In-Reply-To: <20240109132854.669822-2-mheib@redhat.com>
References: <20240109132854.669822-1-mheib@redhat.com>
<20240109132854.669822-2-mheib@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Subject: [ovs-dev] [PATCH ovn v4 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
---
ic/ovn-ic.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 91 insertions(+), 5 deletions(-)
diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 8ceb34d7c..ba393e910 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -1782,16 +1782,96 @@ 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.");
+ bool azs_cfg_equals = true;
+ if (!ctx->ovnisb_txn || !ctx->ovninb_txn) {
+ return;
+ }
- if (!az) {
+ 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 ((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) {
+ azs_cfg_equals = false;
+ }
+ }
+
+ if (azs_cfg_equals && (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 +2298,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 Tue Jan 9 13:28:53 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Mohammad Heib
X-Patchwork-Id: 1884470
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=VE05J669;
dkim-atps=neutral
Authentication-Results: legolas.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=patchwork.ozlabs.org)
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 ECDSA (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8WxB5H3Jz1yPh
for ; Wed, 10 Jan 2024 00:29:18 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id 51F73435B0;
Tue, 9 Jan 2024 13:29:16 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 51F73435B0
Authentication-Results: smtp2.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=VE05J669
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 MvQh298DpL5U; Tue, 9 Jan 2024 13:29:15 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp2.osuosl.org (Postfix) with ESMTPS id AC4DD43546;
Tue, 9 Jan 2024 13:29:13 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AC4DD43546
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 4E690C0DD2;
Tue, 9 Jan 2024 13:29:12 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])
by lists.linuxfoundation.org (Postfix) with ESMTP id 0EFE3C0077
for ; Tue, 9 Jan 2024 13:29:11 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id DA2EF41B69
for ; Tue, 9 Jan 2024 13:29:10 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DA2EF41B69
Authentication-Results: smtp4.osuosl.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com
header.a=rsa-sha256 header.s=mimecast20190719 header.b=VE05J669
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 0r8htn94u6ZZ for ;
Tue, 9 Jan 2024 13:29:09 +0000 (UTC)
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
by smtp4.osuosl.org (Postfix) with ESMTPS id 9FD20418B5
for ; Tue, 9 Jan 2024 13:29:09 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 9FD20418B5
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1704806948;
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=+M/JTJco8Qfv8k62c2crPyUTurlVpyCATcy6gFc6zwM=;
b=VE05J669ve9uMCX3gCLGjfWFeCc6JCnfeAkFNkCGMA6bZfgPiRzNzfgrWZwTxhApWDJVDQ
QDCmV+SOJy+H0atX3XNBCumIrmpqB4kznAxZc/+TgdoZhHakKNZvBMHyc6VxHj2UZweWhT
CYGrTG3YWlKXjUj6lGv/VQAEfCaC7vw=
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-152-poqHA7AQNk6jDS1u64hZ9g-1; Tue, 09 Jan 2024 08:29:07 -0500
X-MC-Unique: poqHA7AQNk6jDS1u64hZ9g-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
(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 1D28685A59D
for ; Tue, 9 Jan 2024 13:29:07 +0000 (UTC)
Received: from mheiblap.localdomain (unknown [10.47.238.59])
by smtp.corp.redhat.com (Postfix) with ESMTP id 46B992166B33;
Tue, 9 Jan 2024 13:29:06 +0000 (UTC)
From: Mohammad Heib
To: dev@openvswitch.org
Date: Tue, 9 Jan 2024 15:28:53 +0200
Message-Id: <20240109132854.669822-4-mheib@redhat.com>
In-Reply-To: <20240109132854.669822-3-mheib@redhat.com>
References: <20240109132854.669822-1-mheib@redhat.com>
<20240109132854.669822-2-mheib@redhat.com>
<20240109132854.669822-3-mheib@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Subject: [ovs-dev] [PATCH ovn v4 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 Tue Jan 9 13:28:54 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Mohammad Heib
X-Patchwork-Id: 1884471
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=gr5BBZb2;
dkim-atps=neutral
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=patchwork.ozlabs.org)
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 (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4T8WxF4Z81z1yP7
for ; Wed, 10 Jan 2024 00:29:21 +1100 (AEDT)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id 3744043652;
Tue, 9 Jan 2024 13:29:18 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3744043652
Authentication-Results: smtp2.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=gr5BBZb2
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 h4tpW982JDer; Tue, 9 Jan 2024 13:29:16 +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 B2EBF435A5;
Tue, 9 Jan 2024 13:29:15 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B2EBF435A5
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 1D4F3C0DDD;
Tue, 9 Jan 2024 13:29:14 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])
by lists.linuxfoundation.org (Postfix) with ESMTP id 3CDE0C0037
for ; Tue, 9 Jan 2024 13:29:12 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id 1DACC41B48
for ; Tue, 9 Jan 2024 13:29:12 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1DACC41B48
Authentication-Results: smtp4.osuosl.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com
header.a=rsa-sha256 header.s=mimecast20190719 header.b=gr5BBZb2
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 lu86XcMd8OtW for ;
Tue, 9 Jan 2024 13:29:10 +0000 (UTC)
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.133.124])
by smtp4.osuosl.org (Postfix) with ESMTPS id 5E59041B27
for ; Tue, 9 Jan 2024 13:29:10 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5E59041B27
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1704806949;
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=rDun1E7IAIjDiIS4+10j5OTF2BZcBd3eM3Kb8WdPOpY=;
b=gr5BBZb2ZXZGlyoBUyQUSwg6brFN+pNKonOitFZnZ88iY7x0n2iB2uWd/ys6fDJLVZtVix
RPMEY+i91MvOXxa0vmkKpHB8kL7uSSwFvRtQTwEabOUlW4DIqHySMgA4KeJBRpVfDD4uWO
kmnSAsLlSIIY+ZC4x+Cmuy5pufMaSZg=
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-672-C0wSybBYMZeZTESeuRJF6A-1; Tue, 09 Jan 2024 08:29:08 -0500
X-MC-Unique: C0wSybBYMZeZTESeuRJF6A-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
(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 1631882DFE2
for ; Tue, 9 Jan 2024 13:29:08 +0000 (UTC)
Received: from mheiblap.localdomain (unknown [10.47.238.59])
by smtp.corp.redhat.com (Postfix) with ESMTP id 685E42166B32;
Tue, 9 Jan 2024 13:29:07 +0000 (UTC)
From: Mohammad Heib
To: dev@openvswitch.org
Date: Tue, 9 Jan 2024 15:28:54 +0200
Message-Id: <20240109132854.669822-5-mheib@redhat.com>
In-Reply-To: <20240109132854.669822-4-mheib@redhat.com>
References: <20240109132854.669822-1-mheib@redhat.com>
<20240109132854.669822-2-mheib@redhat.com>
<20240109132854.669822-3-mheib@redhat.com>
<20240109132854.669822-4-mheib@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Subject: [ovs-dev] [PATCH ovn v4 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
---
tests/ovn-ic.at | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index d4c436f84..f55ffa6cd 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -1274,3 +1274,50 @@ OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
+
+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 &)
+
+for i in {1..5}; do
+ set -- $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg sb_ic_cfg)
+ AS_VAR_SET([ic_nb_cfg], [$1])
+ AS_VAR_SET([ic_sb_cfg], [$2])
+ if test $ic_nb_cfg -gt $ic_sb_cfg; then
+ sleep 1
+ else
+ break
+ fi
+done
+
+# if ic_nb_cfg equal to ic_sb_cfg that mean both zero
+# or both 1 which is a not correct and the test must fail.
+AT_FAIL_IF([test $ic_nb_cfg == $ic_sb_cfg])
+
+# resume ovn-ic instance
+check ovn-appctl -t ic/ovn-ic resume
+set -- $(ovn-ic-nbctl get ic_nb_global . nb_ic_cfg sb_ic_cfg)
+AS_VAR_SET([ic_nb_cfg], [$1])
+AS_VAR_SET([ic_sb_cfg], [$2])
+AT_FAIL_IF([test $ic_nb_cfg != 1])
+AT_FAIL_IF([test $ic_nb_cfg != 1])
+
+OVN_CLEANUP_IC([az1])
+AT_CLEANUP
+])