From patchwork Wed Aug 14 06:37:32 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Mansi Sharma
X-Patchwork-Id: 1972204
X-Patchwork-Delegate: nusiddiq@redhat.com
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" (2048-bit key;
unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=proofpoint20171006 header.b=zQDKH+cA;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=selector1 header.b=Xc8ZIGP5;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org
(client-ip=140.211.166.136; helo=smtp3.osuosl.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)
Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.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 4WkJTt6Cfrz1yZl
for ; Wed, 14 Aug 2024 16:37:54 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp3.osuosl.org (Postfix) with ESMTP id 9864D60885;
Wed, 14 Aug 2024 06:37:52 +0000 (UTC)
X-Virus-Scanned: amavis at osuosl.org
Received: from smtp3.osuosl.org ([127.0.0.1])
by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id 8c8fhYv2yTaL; Wed, 14 Aug 2024 06:37:51 +0000 (UTC)
X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56;
helo=lists.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 496C460814
Authentication-Results: smtp3.osuosl.org;
dkim=fail reason="signature verification failed" (2048-bit key)
header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=proofpoint20171006 header.b=zQDKH+cA;
dkim=fail reason="signature verification failed" (2048-bit key,
unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=selector1 header.b=Xc8ZIGP5
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])
by smtp3.osuosl.org (Postfix) with ESMTPS id 496C460814;
Wed, 14 Aug 2024 06:37:51 +0000 (UTC)
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id EDCABC0A97;
Wed, 14 Aug 2024 06:37:50 +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 79181C0A96
for ; Wed, 14 Aug 2024 06:37:49 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp4.osuosl.org (Postfix) with ESMTP id 5AD19404E3
for ; Wed, 14 Aug 2024 06:37:49 +0000 (UTC)
X-Virus-Scanned: amavis at osuosl.org
Received: from smtp4.osuosl.org ([127.0.0.1])
by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP
id uuEVSQvcrlGz for ;
Wed, 14 Aug 2024 06:37:48 +0000 (UTC)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.155.12;
helo=mx0b-002c1b01.pphosted.com; envelope-from=mansi.sharma@nutanix.com;
receiver=
DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org D8D78404D3
Authentication-Results: smtp4.osuosl.org;
dmarc=pass (p=none dis=none) header.from=nutanix.com
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org D8D78404D3
Authentication-Results: smtp4.osuosl.org;
dkim=pass (2048-bit key, unprotected) header.d=nutanix.com
header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006
header.b=zQDKH+cA; dkim=pass (2048-bit key,
unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256
header.s=selector1 header.b=Xc8ZIGP5
Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com
[148.163.155.12])
by smtp4.osuosl.org (Postfix) with ESMTPS id D8D78404D3
for ; Wed, 14 Aug 2024 06:37:47 +0000 (UTC)
Received: from pps.filterd (m0127843.ppops.net [127.0.0.1])
by mx0b-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id
47DLYmPk003584;
Tue, 13 Aug 2024 23:37:46 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=
cc:content-transfer-encoding:content-type:date:from:message-id
:mime-version:subject:to; s=proofpoint20171006; bh=76ZwDAddDYGtq
kiJAJBlbmHdeUGci+BXQRMm6I00x+A=; b=zQDKH+cAiuoVUoV5j5zAFdWqbqBkS
CCLvWTxEPBgJbiKB+fcSqpXfFEEN9ISk+zfhwLwkLdjXOUNVOfkXDpnXbb0k8134
R5cumhWr34MJhVpqIJIWj0aQSBh1ylq0Ud/WFjGxUqJI6HiiZT0Pl/J/T7oHKBof
DioKTz645JxY4+l7ID2HmN+JbgsFYduxZ0lixmjLiA4a17SIhxMbOO0hcd4o57Xs
BWsqvl4Fgslmd5zuOR4NBFkVRO6RSM2lM9OwFTcWxWomZ7hb1egJSP5Bd5bhLvk4
copyHZQtRWLa/AcVQMUSaFhRot/x1mu+a4XU10Iq9cLI90rknj8OS3+dA==
Received: from sj2pr03cu001.outbound.protection.outlook.com
(mail-westusazlp17012038.outbound.protection.outlook.com [40.93.1.38])
by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 40x6aeywmh-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 13 Aug 2024 23:37:45 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=Te1UlZmhRJV8ldcKM2qUN28pjJhC2Qk6nbuZu6QsQ6FY8IUN5jj95agvQ4ku/qJEI6TSxjIn1LP/YZ06eT5R9JZSpyEPg9psrs5CCJ6ngpBOypkdTwyw2HKQ4Hr0S05ZLNT8LvypuP82qSYfBnEpGiOcUfOL9NIA97QPlNmzEzGbMq/2/NjtdCjs7A7H7FPdAzdiq86xzBLmlZYszB00Zi6ZgsVRpQrcRPNBjN8b4IxP4PfiohjnhuqpC4R7ab7xDurAGoEp5PrcErKCTV3HznwK3Fvbxap1KcVeOYgzEAGxhqRRvoFjvJCVi8YaXZVcFpKG+bwrepvmo28coFYliA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=76ZwDAddDYGtqkiJAJBlbmHdeUGci+BXQRMm6I00x+A=;
b=jv4Ri0/oHSAF0ID9cFY5neD6jU0z32fJGggM3/JOiQzuzdc2XPjDveXB/vk+BMVo/Fn4ZWuJEsr9rJfbGAGS1DstL53sJjQNuRoQ2dl0996Dt6vl3sjIN49VcODvJlWkhQDXWvITV6ufYTaC7V/xqrljGXvGAT3AE8y8ei8qpuV2o9yT0WVaxU4G+HVv+erc+NoOEeJ5v/avAdGjAUb1nH7IAwJRfaO6+ldisLQU9acC0Qx/E42AxQPI9N6YGrguy4rSuF8ZGgZTzXZlkPOmfkQGkOd7BJqTIEy3V9gEEs1qBk0BmafvYx293Bem/LCWyIgaNRBcr51SJ/mVHOQwxw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com;
dkim=pass header.d=nutanix.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=76ZwDAddDYGtqkiJAJBlbmHdeUGci+BXQRMm6I00x+A=;
b=Xc8ZIGP5aztSaPsS8igwWx+CvsyGRsEhePSdXT4zDcsQOSOEfD2QkT0hMzcR7xVMi8mwpeLyZyqCAoBev9jAH2Z2bfMvk2dr97+Mz3DVJvrQmJjJwza+qwHbOIRYPM5ot0kvHxWIenbPKAC2B6LGHF0NgrkwHTyi7fqWsP/DesAnBBVVnzGUUQiccpQehTDdL9QyT6FDTZ/zvWfhuXBbI/5dV7AmJn5NY2LrzV9fUoDQrmA4bBvurV2FaSkQxhrIDe1aR+X7kekkgnYCLFe9w9H9kCtiFh3aJ38AlJvi1AHRCd4MMixCLiVruTr/6gAy2I4x2MD7X1N46pptAvtj2Q==
Received: from IA1PR02MB8924.namprd02.prod.outlook.com (2603:10b6:208:3ac::18)
by DS0PR02MB9080.namprd02.prod.outlook.com (2603:10b6:8:13a::16) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.23; Wed, 14 Aug
2024 06:37:41 +0000
Received: from IA1PR02MB8924.namprd02.prod.outlook.com
([fe80::ebb6:325f:1d33:c1b8]) by IA1PR02MB8924.namprd02.prod.outlook.com
([fe80::ebb6:325f:1d33:c1b8%3]) with mapi id 15.20.7875.016; Wed, 14 Aug 2024
06:37:40 +0000
From: Mansi Sharma
To: dev@openvswitch.org, numans@ovn.org
Date: Wed, 14 Aug 2024 06:37:32 +0000
Message-Id: <20240814063732.169230-1-mansi.sharma@nutanix.com>
X-Mailer: git-send-email 2.22.3
X-ClientProxiedBy: BN7PR02CA0011.namprd02.prod.outlook.com
(2603:10b6:408:20::24) To IA1PR02MB8924.namprd02.prod.outlook.com
(2603:10b6:208:3ac::18)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: IA1PR02MB8924:EE_|DS0PR02MB9080:EE_
X-MS-Office365-Filtering-Correlation-Id: 5927aca6-3d50-4015-affb-08dcbc2b9852
x-proofpoint-crosstenant: true
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
ARA:13230040|366016|1800799024|376014|52116014|38350700014;
X-Microsoft-Antispam-Message-Info:
y2JRIiihLrdbSX4gncDopluIUHcZsrjNqpwIQemYAqQPnp3wDRbM6TDd8wEvTO7IrauEVu5Kwtl+fEGLrqnCDCXOL/ODgjNcQl2ZpCe3LfCw1oUR4gy7n3aRcTciGJ1ZotP8XFxscZxHxOVO5ZSeHlpw2SSX81N6nQDxEG89teJC9+TLPwTibPxcFm96ZybBNZt3iMf4i8EeYYvkftyAEym5tPTENRi58o2jZEtsY3b5P+e1aeAtnsj/taeB6yW7r61hYx+us7c5GAT+MHEnSIMxlfT14BUyQ080jzlf3BtBRCOIx+8yxQBvfSYS0eUEFIbtK8LAZDE6iwfbKAs4iMT/IqbAKQqBgWiluy/bBRVGuWBdn7Jmiw8JJ5YukN42sfZm62Y4JPMhRydEb96JNA8gc367yYQRVGstzY61fwOfsFtXainlja03X59D4Ufq5IyTMsXGIt057GWSWGoOnBmXGeRI7JSvPqbCresfyGKpqhWpm+kROVCBZ3CQv5ETfY6ENkKwqaNFku6XsW4CZC94IORzxw0Ny6kWn807EhMUpOU83sOb5D5xDr0jz5uwR2kIcfSBPkmHk0McP/7oq5OfXBUlMIBINdJC2pivOW8nCSEN83Qhl6Rl6YDfGRTs1gNGD86FMOtRMf7MsnTUrQy1Neh0w94VWjfqRy8cnO+wNHW4xn0Nk0XOpS3DD0Oa7d4QJpJlFPz+ROZ8ntmcwPv5P1xPNgbwPMChGqnLqGfCpuvVxIJEBqxNezNxKWIshrBfh6wFYvpOPrSmA65W+V4Iv9L0RhDOhebRDKCnk7LV2fqoyXSRL5Bh2U3Ifu7fRnSNr/zis8sFYxXnmZLohItFz5OHUxXNyAO23SkedRYTpbFOrhqMADkGl1lTUns48ZxAawqfAdNOCh7jDwQXp8gGhjAshPRubbLl9pBZpRF3vuB3hCHQaOAFgUIIwC3YrdUNKx7SJh/3HKDLDsTj/g1dKQsmoX9idZz4Clj9E+3Y2E/mGPxFfcy9JqocOWp7ZgGVyiEgDkQsRdYv2wTqpRbBvc7aFT6A4QSXs3L6H50ccMPYK2MDsXckfw+fvn2tlu2f+A/Ghn/yK4gRCJa+KR68XyztT2IJ4hgLbwe0BanNfjzFLyscq3yxW6RF8GO57siq4iQu9KMBahAoZODH+VPx7T/pIxwxfDXZEY0AOpMEK57182JHvAYh9weu77m3qyXJRPLf+e+O/IeswG3DaupRWex1j4nRnoTjA5d+4sg0dx8b54PXADheXBKY5K5Pq9ng4nLXO1pHkXntSSN+c9Ihno62J8qCzjpa24Qx2vfImXDkXH74ECw6iz1annzpuCqdesg6auCO9qwpBxpPguZm4Ni7WZ3XbaEXrSGPy7+/ZlbUk2pQUqsR2TTUSukHcUhuAVrMyQxd+oFF+fnteA==
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:IA1PR02MB8924.namprd02.prod.outlook.com; PTR:; CAT:NONE;
SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT;
SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
eSi7O+c7An5SgTcH2sr3EPymNJVdPZ/McUBBWlReCJq3x99l5llw9llF4L+tm3doVu1zcArzkp2kNoecY2jT36LlboXkqzCyyq1duhZkU2mNLtWxPQnn2KgV2kdRJ/+KyjzX/PnE3Kq/1rClu/DEsnJHiP/q+jInHd2n39xsgjvQimiW2XEbKuwQyTTDtqf6+uVE7BMktD+mozjb7QdZ+ON3Ouw3DPSQ5+MGXY2yrqVpOFm+LMnkK9TWBg3qmMoc5gZUtZNICEVhbWrP2HXxxopM7zLhMtZTy/JZ5en12i3Cvd6+lurwu0iaSL/PpnDpbMp8WXD7hZ+RgP3ZmyTkqgyuXSjWfssmpTPDZXDv+zWttVZcML+UVdg2wbw0VPQtck2eKQGj+rWOaFZMekWAb8XhTjpXWV1RwRxu2iBkr+ur7epGMgUtrb6q0z2WZ5dcRBrxhyjy4OEB+ZmR4gwkGwKNmsnIIzEp94QSwonsa44z3hZACak8J+gebO9C9jQVhs8eZWliuFP8hZDC7GGlwn73FTQsWW5qF711EpwBcdicGcTW8xLsOFxMq0SOKtPwttaOFiLBqYnIRb0Q0qjNH7PGY7HfUbAE9ANb891vZJmdwajMpAiVQkcpaT91JCwfkBjUMc0M33p+Q1WQqac6m72YIO6YKzvVkoWmONRR6u9OYLuD0RCTtyUs7nRp/3zjpfy7MB3/NxHLIzYIcuzUnlGE2j2sd/PUAyN+P2PXKBRFINiOqmARhnQWr0go8CwDP9s8lvu+UjNb812I+yMes4QAtbx29NzqYg6FKhM1if8F6aiiWsLBWMXMkStwYEBaB0j/8Kxiwx1L78nXZAqQo0NZ9Y+MwFCOuO0xCVX2pI6msqbFBO6z/StM3mJpzt4m6yG2GvKIG6u3beMtE4D51+WKl5ahAJ2ZIIhfAirPVvFq3uHiahYk3kW1VVaDMjsJirDVjEDXggJoAfqWgdN13P5BkZXnLWM/rtCUo1c9MHGlz+pA6dWwrJk4Oj7rfrIpXXkLh4WZpzFgGB8BEM0lTzEWVVtqUO0ou5L6BeKflNJghxU0KJkcOF9vXSAl1H1ajEeeRti5U2vpqXVf9MZO5BkbdtlQ7Sv6x76Wm4mhPXySztqvgLH1KT6VPjE3JQZaiPoqUF80FHlw8GZb+3WDXx9kvLdOKeMOP4bXfLIUCoSHR5S5rbxSWasLp+oTvUkFf2saLGUQdOfCoJ/ZUoLINyUiXuSDGT4vESca07eWvP8fKP2tvGiEg0EhWILcIIblwfOrgxMniO1B1iM8boVXDw5qo+eqR1LsIhsl11nsa8CznCmPWCKHG2TEyf7dJdJbbXxAllt5c5OssTtZMbuGfFW0ZIdufUo8akacxKkIskjUN9AzEfR8Xm+1ayPhZXAm4oP5BFfKvtAkJL5962I4/nwSdh64ufstBEPQdNr19JQ9q4qcmVr9SLkoIV89zEd6UltOEN4avTXIDeFb6x2vieUaTr7jW7MfC0wtnc8274ELcS+1oGrTvdXL+I2yulFQhy29/4uN5lCUn4A3AtthJJtpA0yJPf8hqaxdpLndlfn14EtaCLt0ISc+LOAVSERNgQpGYhiYvv2vb+mK3qqPvA==
X-OriginatorOrg: nutanix.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
5927aca6-3d50-4015-affb-08dcbc2b9852
X-MS-Exchange-CrossTenant-AuthSource: IA1PR02MB8924.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2024 06:37:40.6364 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName:
+qYClm0lvkuWRI89+uUr9tJBlJDO5H6zqgOfp+9NDuYkeOD5xsTjz60iPiPHKBkiJRqSsNlaqaMFAParYgyWXOxMfJTAhrBAdcYNI/3StFY=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR02MB9080
X-Proofpoint-GUID: 5Dib-_BLFR6SIFrSpZL3Ba91OEx0I5FU
X-Proofpoint-ORIG-GUID: 5Dib-_BLFR6SIFrSpZL3Ba91OEx0I5FU
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16
definitions=2024-08-14_04,2024-08-13_02,2024-05-17_01
X-Proofpoint-Spam-Reason: safe
Subject: [ovs-dev] [PATCH ovn v3] ovn-controller: Reserve zones for upcoming
ports.
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.30
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: ovs-dev-bounces@openvswitch.org
Sender: "dev"
This change will be useful for migration cases, where it can be
used to sync ct-entries before port is up on new chassis,
resulting in reduced network package drops.
It also fulfills the need of any other service which might need
advance ct-zone reservation in future.
Signed-off-by: Mansi Sharma
---
v2--->v3:
1. Correct reference of external_ids key.
---
controller/ct-zone.c | 22 ++++++++
controller/ovn-controller.8.xml | 15 +++++-
tests/ovn-controller.at | 92 ++++++++++++++++++++++++++++++---
3 files changed, 121 insertions(+), 8 deletions(-)
diff --git a/controller/ct-zone.c b/controller/ct-zone.c
index 77eb16ac9..79632282f 100644
--- a/controller/ct-zone.c
+++ b/controller/ct-zone.c
@@ -183,6 +183,28 @@ ct_zones_update(const struct sset *local_lports,
sset_add(&all_users, local_lport);
}
+ /* Add local_loprt name which are supposed to come up on the
+ * chassis and might need ct-zone reservation in advance.
+ * The data is picked up from ovs_vswitch table. */
+ const struct ovsrec_open_vswitch *cfg;
+ cfg = ovsrec_open_vswitch_table_first(ovs_table);
+ if (cfg) {
+ const char *reserve_ct_zone_request_list = smap_get(
+ &cfg->external_ids, "reserve_ct_zones");
+ if (reserve_ct_zone_request_list) {
+ char *duplicate_reserve_list = xstrdup(
+ reserve_ct_zone_request_list);
+ char *reserve_port;
+ char *save_ptr = NULL;
+ for (reserve_port = strtok_r(duplicate_reserve_list, ",",
+ &save_ptr); reserve_port != NULL;
+ reserve_port = strtok_r(NULL, ",", &save_ptr)) {
+ sset_add(&all_users, reserve_port);
+ }
+ free(duplicate_reserve_list);
+ }
+ }
+
/* Local patched datapath (gateway routers) need zones assigned. */
const struct local_datapath *ld;
HMAP_FOR_EACH (ld, hmap_node, local_datapaths) {
diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml
index faefa77b9..b070b724c 100644
--- a/controller/ovn-controller.8.xml
+++ b/controller/ovn-controller.8.xml
@@ -626,7 +626,20 @@
external_ids:ovn-installed-ts
.
-
+
+
+ external-ids:reserve_ct_zones
in the Bridge
+ table
+
+
+
+
+ This key represents list of ports which are supposed to come up on
+ the chassis, and hence need advance reservation of ct-zones.
+ It is comma seprated list of port names.
+
+
+
OVN Southbound Database Usage
diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 74bff9035..7910939aa 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -2535,6 +2535,7 @@ check_ovsdb_zone() {
check ovs-vsctl add-port br-int ls0-hv1 -- set Interface ls0-hv1 external-ids:iface-id=ls0-hv1
check ovs-vsctl add-port br-int ls0-hv2 -- set Interface ls0-hv2 external-ids:iface-id=ls0-hv2
+check ovs-vsctl set Open_vSwitch . external_ids:reserve_ct_zones=ls0-req-hv3,ls0-req-hv4
check ovn-nbctl lr-add lr0
@@ -2560,17 +2561,25 @@ echo "$ct_zones"
port1_zone=$(get_zone_num "$ct_zones" ls0-hv1)
port2_zone=$(get_zone_num "$ct_zones" ls0-hv2)
-
+req_port3_zone=$(get_zone_num "$ct_zones" ls0-req-hv3)
+req_port4_zone=$(get_zone_num "$ct_zones" ls0-req-hv4)
snat_zone=$(get_zone_num "$ct_zones" lr0_snat)
echo "snat_zone is $snat_zone"
-check test "$port1_zone" -ne "$port2_zone"
-check test "$port2_zone" -ne "$snat_zone"
-check test "$port1_zone" -ne "$snat_zone"
+zone_list=$(seq(port1_zone, port2_zone, req_port2_zone, req_port4_zone, snat_zone))
+for i in $zone_list; do
+ for j in $zone_list; do
+ if ["$i" != "$j"]; then
+ check tests "$i" -ne "$j"
+ fi
+ done
+done
OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv1 $port1_zone])
OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv2 $port2_zone])
OVS_WAIT_UNTIL([check_ovsdb_zone lr0_snat $snat_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv3 $req_port3_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv4 $req_port4_zone])
# Now purposely request an SNAT zone for lr0 that conflicts with a zone
# currently assigned to a logical port
@@ -2585,15 +2594,84 @@ echo "$ct_zones"
port1_zone=$(get_zone_num "$ct_zones" ls0-hv1)
port2_zone=$(get_zone_num "$ct_zones" ls0-hv2)
snat_zone=$(get_zone_num "$ct_zones" lr0_snat)
+req_port3_zone=$(get_zone_num "$ct_zones" ls0-req-hv3)
+req_port4_zone=$(get_zone_num "$ct_zones" ls0-req-hv4)
check test "$snat_zone" -eq "$snat_req_zone"
-check test "$port1_zone" -ne "$port2_zone"
-check test "$port2_zone" -ne "$snat_zone"
-check test "$port1_zone" -ne "$snat_zone"
+
+zone_list=$(seq(port1_zone, port2_zone, req_port2_zone, req_port4_zone, snat_zone))
+for i in $zone_list; do
+ for j in $zone_list; do
+ if ["$i" != "$j"]; then
+ check tests "$i" -ne "$j"
+ fi
+ done
+done
+
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv1 $port1_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv2 $port2_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone lr0_snat $snat_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv3 $req_port3_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv4 $req_port4_zone])
+
+# Add port named ls0-req-hv3 and check if same zone assigned
+# previously get assigned to it this time as well.
+
+check ovn-nbctl lsp-add ls0 ls0-req-hv3
+check ovs-vsctl -- add-port br-int hv3-vif3 -- \
+ set interface hv3-vif3 external-ids:iface-id=ls0-req-hv3
+ct_zones=$(ovn-appctl -t ovn-controller ct-zone-list)
+echo "$ct_zones"
+
+check ovn-nbctl --wait=hv sync
+
+req_port3_zone_new=$(get_zone_num "$ct_zones" ls0-req-hv3)
+
+check test "$req_port3_zone -eq $req_port3_zone_new"
+
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv1 $port1_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv2 $port2_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone lr0_snat $snat_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv3 $req_port3_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv4 $req_port4_zone])
+
+# Checks for two cases after removing entry from ovs_vswitch table -
+# 1. If port is already up, ct-zone should be reserved.
+# 2. If port is not up yet, ct-zone should not be reserved.
+
+check ovs-vsctl remove Open_vSwitch . external_ids reserve_ct_zones
+
+ct_zones=$(ovn-appctl -t ovn-controller ct-zone-list)
+echo "$ct_zones"
+
+req_port3_zone_after_delete=$(get_zone_num "$ct_zones" ls0-req-hv3)
+req_port4_zone_after_delete=$(get_zone_num "$ct_zones" ls0-req-hv4)
+
+check test "$req_port3_zone_new" -eq "$req_port3_zone_after_delete"
+check test "$req_port4_zone_after_delete" == ""
+
+# Checks for case when a ct-zone is reserved it comes up on that chassis, and
+# gets deleted, but its persisted in ovs_vswitch table, it should persist the
+# same zone throughout.
+
+check ovs-vsctl set Open_vSwitch . external_ids:reserve_ct_zones=ls0-req-hv5
+check ovn-nbctl lsp-add ls0 ls0-req-hv5
+check ovs-vsctl -- add-port br-int hv5-vif5 -- \
+ set interface hv5-vif5 external-ids:iface-id=ls0-req-hv5
+ct_zones=$(ovn-appctl -t ovn-controller ct-zone-list)
+echo "$ct_zones"
+req_port5_zone=$(get_zone_num "$ct_zones" ls0-req-hv5)
+
+check ovs-vsctl remove interface hv5-vif5 external_ids iface-id
+echo "$ct_zones"
+req_port5_zone_new=$(get_zone_num "$ct_zones" ls0-req-hv5)
+
+check test "req_port5_zone" -eq "req_port5_zone_new"
OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv1 $port1_zone])
OVS_WAIT_UNTIL([check_ovsdb_zone ls0-hv2 $port2_zone])
OVS_WAIT_UNTIL([check_ovsdb_zone lr0_snat $snat_zone])
+OVS_WAIT_UNTIL([check_ovsdb_zone ls0-req-hv3 $req_port3_zone])
# Now create a conflict in the OVSDB and restart ovn-controller.