From patchwork Thu Sep 12 15:54:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mansi Sharma X-Patchwork-Id: 1984751 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=L8BL5Gmq; 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=rNneP2v/; 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 4X4MSz4w4Bz1y1C for ; Fri, 13 Sep 2024 01:54:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 30F4F81E54; Thu, 12 Sep 2024 15:54:41 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id WywvPVrf5Ef3; Thu, 12 Sep 2024 15:54:39 +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 smtp1.osuosl.org BACE9817FD Authentication-Results: smtp1.osuosl.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=L8BL5Gmq; 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=rNneP2v/ Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id BACE9817FD; Thu, 12 Sep 2024 15:54:39 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5EFC9C0012; Thu, 12 Sep 2024 15:54:39 +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 22E39C0011 for ; Thu, 12 Sep 2024 15:54:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id ED13B41A33 for ; Thu, 12 Sep 2024 15:54:37 +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 qyy5HoMtowKz for ; Thu, 12 Sep 2024 15:54:36 +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 662E541A30 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 662E541A30 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=L8BL5Gmq; dkim=pass (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=rNneP2v/ Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by smtp4.osuosl.org (Postfix) with ESMTPS id 662E541A30 for ; Thu, 12 Sep 2024 15:54:35 +0000 (UTC) Received: from pps.filterd (m0127842.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48C7XBvV012719; Thu, 12 Sep 2024 08:54:34 -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=M+RhzKVTbWbrD OLuYt5Y+qkZlWXDeo3+bdsyKRy6K4o=; b=L8BL5GmqU39y6gdtogFcsJflyNdw6 0TQLN0MDl68A/K/cym6L1ONN7Mnd5AL2zM+7+G+b6Cx48DXHQX7qaqHvwoTUWyPH 3fURzVGUze+7VzQ7xm99iOHUeA/P9pPAul5xO0IEHDBDypFB6iXMVXw3X8kwBXKj TmX5ajYNXd4P11KM66vIUNPHx1owg6YSsGCUW43kjCTjK8HQl0cjPuHo8Wq6oV+C dAyyTILM+z96S7us51c/clIQr7XxPM7K6DIawRYNrM0FrtGAiWQkKms+XqAOl/Qq 7Z3xK67KaKlR1jUXSRmOWKeKEP8dof2TMJX5AH4dB+mRXbQ/0VnodLCoA== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 41gp5f4pyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 Sep 2024 08:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v3qShPTWQmEPzcex4b2lcf6AS94OQTG8TpzuUyG4MteeoDAIXGYh0CgWiI8djt+s5oKkCvgFYIqYndc+QlYOW1RG6DMKLiF+N7pXkJeeNaNrRIALTOKxAKb1ZmoXl2jYUAGLFKzOL6VxZyBvUtIQYco7S9oGFnJ7k8Yimt5btytjFFeQcMkD3vEkgEFgQMyRuyqeab5QBKvo5/uknctPDSOU0uUBVqoN3nc1wjOUx5/Bw7UB7hgT6zXriknwF722mtDtnBPa366fKyFgV00zQkaAUtbDGW4Qw8i5ySIOfn9p/XpqYS1t5gkl5NjldDcGmjKLFFEZexGXlCxeaSC9nQ== 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=M+RhzKVTbWbrDOLuYt5Y+qkZlWXDeo3+bdsyKRy6K4o=; b=tp9ysdWOquJNIwuO1X6cUDi7BgIWay0724vlFUyP6rR8HwcHOb1elMk/dqg8I4d6qPdXx7MM1NyugHcxdIftbbCYV7OzwWHHaB5L6lb4Qv0VHIUj3fny5TR+f0k0SseZabB9ZJeKKufl4KwhHJyn1fPrHt/pvllpv983pwnTZilirvWqm43KvpdCDoEeX/PDK/gpjcfOxIp0iqVNHdQARzKJ73w0XaEt9JsBFXCFOCJROKESY1qTybvJV+/9aFsqckhVnHSo7vlyyO/ByplaRAJj53lohXZmXokuBNgvje6lL5uT8NKOQyHCf0pKGmuRn/Q2q/DjsTIj3vfQ05BXQw== 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=M+RhzKVTbWbrDOLuYt5Y+qkZlWXDeo3+bdsyKRy6K4o=; b=rNneP2v/huge3CIPUdVa1ZhpTEqsdB+3xLuQuKWZGkuA+JaMTLtD83R/+iCTiUXOkJnrxSu3+QEHLBOVBlpAxCZHmelLFgFNTMzuJ+mL+abauobaWSBPLZBnVS0Pna/NcsgcJ9PnzN4Nf1CaPE1SvmtPzU+f7dXyWZOkbdoxiNtOfWIfphLSc1fOWVSRJ5M0wWcmv367q6TCdfh8iDh7shaCnkEUpb2GYeDMI2MWHalOX/N/A9Fw6F39IgKzH8ZLKrdM8N4QkWnFeN5nxsjs6yNbnALS4FbBtkvIYbKYZ264IUiI03hnnC8RVFS2li4KGdW5BQ+QCNT1YzAVlo7w4w== Received: from IA1PR02MB8924.namprd02.prod.outlook.com (2603:10b6:208:3ac::18) by DM8PR02MB8123.namprd02.prod.outlook.com (2603:10b6:8:1c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.18; Thu, 12 Sep 2024 15:54:28 +0000 Received: from IA1PR02MB8924.namprd02.prod.outlook.com ([fe80::ebb6:325f:1d33:c1b8]) by IA1PR02MB8924.namprd02.prod.outlook.com ([fe80::ebb6:325f:1d33:c1b8%4]) with mapi id 15.20.7962.017; Thu, 12 Sep 2024 15:54:28 +0000 To: dev@openvswitch.org, numans@ovn.org, amusil@redhat.com Date: Thu, 12 Sep 2024 15:54:17 +0000 Message-Id: <20240912155417.163026-1-mansi.sharma@nutanix.com> X-Mailer: git-send-email 2.22.3 X-ClientProxiedBy: BYAPR01CA0051.prod.exchangelabs.com (2603:10b6:a03:94::28) To IA1PR02MB8924.namprd02.prod.outlook.com (2603:10b6:208:3ac::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR02MB8924:EE_|DM8PR02MB8123:EE_ X-MS-Office365-Filtering-Correlation-Id: b02f5d5e-b432-4a3b-9bd4-08dcd3432ee1 x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: zcI7Sm53yhu9ugCDIYvuIIT7tdwG3SVH+bHey9FjpAzK9o/lf0b0WixhOh2B46EujAAqV4slgoq8VOlu3K4LjZtAqO+0/jSsIYZppsZVw5Ukcy2X+B25Ch8p0hYDOHYEhdFmUVN6kW3bkPXA9Ky2Vsi+lJp1OL+Os3oThqptMahZ0IWzMYivxbCBDM/BiclzRzfd2o4nncnUouZ0X9dBykRWF9csWYTQRJC7SpP7Z03wtr80/2wCYL4lOB++0PCU2BzzHUcp5dNrdgdYDSpdYSFsFrAUpt5cdX0bl3cngsBo1Q1uSWUJf4o4RTZqYh8NaFwdPkDf6Z3Ei/Rz66WzOEFmwbKf14LydwA5v/YyzDZPSL6z8mMjg7IhT2aDeN4B9qMAWhe6cQsNxUyzblfLXSj1ZYOiGuu1GuFTVCAPhx+e4YBq14ouNcHvnrs+MCgiw2UDDx7BbJT+1OPtqeD4UZ93VMwrRnmEirBcGezWLGf4chjFzkRy2flNpxtsBlnnpA7FjOikPqyX+sdIEDAmzdCXLl5psQXQyiXHAsXF841IMtNR5HDjAEqArU32Y5JmDHsaXFrjOQfoMwLoQgejdoQHzEwksDdhc+dyDRzbYnU3cwoUtLvlrHR0a4XSoSYtwJDn1WuSJ39062amV0N4020vvDdsFtX47O+KTeMExoyYpMMmRtVq5rBQjHpcgbPMr/wrmyNFbkFrXEGBD5FEFV7pbe4rIwf2AO7GaSlZxTLzmq/dKVsnE7KJ1FYWXCx6mGZ12NMsnpJv/1A505YuQ/idy/w2WbqKWUf8N8W+T5wq95i2El6Nw1K5AzMrtltpxIolxuUN7RyAaMsboMDuZcQ/mivihKariGFPu6t7Fxq+vBOKa9/pk+fnO9mvvG0fmPXBcPKffxnu3VKlkmJhXpgvduGiGI+ArOwfLf/4isT/d6/Cv//lqqG7iTvsuy0pRCvPx0VOkEMAxQe/p2vL1jKNB3xo8fTTZ9fevPbLvnKPUpuJk9r+HhkFLJ2cgfgBq1EjheqgCg463JJ3Q71XviDZUf5qoQf60l8lete8pcJMjQV7ZJPSZ9zy5QJW/8n2SJ/rz/mPiflamCcdL4pcv6IeEwT/qrceH6b/kUT3PNRBJBza7C8pmY6ZzKpy+v3XhEbeI0J6vbrIBMz05Kj0YQvBza2xVfYYrcI9zHOMs4EAV9HjU/6m0djlkBEYdDDs8uvvnIE0VKgfOeu4tTQj3BeEOjI8vEHXCLfrh6bEwn1xH/MhDMqhmBrnMRYwqjGg0QPwEBZmee2D1mr4ggG4CmzzJ8nQ8AkmP0vJ/B1XUNdkAhZNjipmPNl5z7Jcxvg5sjeC4KT9Gzd21q8HVL0Hst447UvPslAlkKI9B7m/wmMexsgAk93NzLbrHVs5Snu/+BBcb9ZWhxryRtSDjDtk4g== 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)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 78h9J5+uftSadcIv7d854XjYFdeBqEz2ftYHdvq9kCrU4Pe4njIJ4uuYOQJbx43NEaJuTps7eSVTdDUe6pqKH6poFOjrdq8Hmw5yGUG+RY4gLNRmvs2hC+qIxZI747X8mO50dxF6mAOdXqV6qf4SBftWcGpLNhmLkGUj4U4dY+LGuwZbzYNPP7JXfRcrh7yBUBZuYW4SnaHdhX0QmoAUHxrAgAY5m49uT07zqAcchkFZdKQCDIAGvnV2IIXT9EHquWFCI4m6rknoN50WipxF5BUNvIHmvVeG4CCa4Mmk/Mumv44pbrPD3aOaDut+nStjVfQA1n1BQiZGVnNCf89OhN7I5YvbesV9GCJ0aFRxGaLekfbcQ81yDabOQ89k9Q2DDqLymVDAz4r+2McxEoRVUzmRGxrgn83aHAwi4ZbiikUAvTG1c7g60AgklV9noelrAPrZP2U0Bo+cE/1MBSNEj2IqAh9k+vWF228nwU/CWgZYB6Tg2A0aV0+0FZe/N6MdSy8NZaKbOyxBTb3NyjH/cXEK9PHl5dZXtSRuYBxGi3PHD2KZRG517ts5rJf95cafFYxKgYWFkTDHylJRRLqCYyge5Ye9pC9PMkxpoyymrEJcdlxU0GkF+yy0rra3kjirPrWuNOU2mbPq/FHFM8ObV+JJgYnqgGlPA6PgJxHplClbO29LwvtsuZpuRHYeJfX1TickoGNYsXKlhZJ9NUqH7cueYDeAxAa2MTs1gCfAk+8Bu5JHKD+fClUj0lhanjqN5EhpBUwCWk/x3YHQXMf4h0yjw++z/PauzRQlWglOsP2hEhjdG7XToXLkcmSJKjnxBsqyOEqrRP9fo0f8buX8fNYlueJ3s8XuLKjpO9E7fEJl/q1303giFWOlvH2X59Ke5osn+aebTjyP7w1XCGwqfqtsSqiUFM8ZRxvpiZSm/Fa9El6PoaTqpiOfTfboX3WT5o+L5tpkYCd2+k9qBLr7bMbou82O6YS0ASiaT1GjfAMDmCmIdsUjpj61/QSuCp8B/2HoqcUCajSIAwpNl9BWYF8jODPNHK4ik3gO8ZdLMvk76LJ/HjGLSbe4cDfSKx2p2DFogeL81UEmg0pvdIJqfXKGVIAIMJKvlhx2redk534aYlRpx/kvDKRZysH61vneuWX3Pf4kUPfzgl8Bd4BY8CCQmuYnc3HQMmyRbjfVguYcaNSmnJzAnmcjo+acNb874nst3O7Nk4eFE0tcuEIr0FkXuQmKAdtoc1v0MT52El9lK1UKkh/Yr9x5V3XiiScXDd1BG8icGSTsjZwECAD75jzlFvFyLFAM++gzamRcuwMO0XxYdh6toPTeiMdOX4e2cMxypilMTPIgz92DHZIz3WTB4ovSzs4yarnJAtwmri2JZ0w8eqtcaII4zE1Bhqjsht4rQSe2pgncOmNKMsnOqPjc44rLMR21g4PsfWT0l5OnfwFdxTJrI6N4eZEXcF/yUHuVc8mJhwc5Jk6PjwjMqDrgeY6sxGBFX0XcT0lgZtkE7fng6Ch4Jauh8JuUhEFgIzWEYkhM7iSu44S2/6BnCdAK+kA9rFWpRLAHg+MkUEYOKNG/rZ5VAfabfq5ZglBKjPkJVUBKLtPkFO1qmMn6WA== X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: b02f5d5e-b432-4a3b-9bd4-08dcd3432ee1 X-MS-Exchange-CrossTenant-AuthSource: IA1PR02MB8924.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2024 15:54:28.3904 (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: 8dAtnPRRLSBNAQHbijcIxgX/Dprc1gmXDrvwFfiZH5Lbkl++mo/YOSW9GqYAVPZ8e4OTUs75NtDCH4u20wqc0f64drYb5Gp42HOidgjMS4A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR02MB8123 X-Proofpoint-ORIG-GUID: ByD2ksfgzbDyvhxiDHpfXRheg1qI9X45 X-Authority-Analysis: v=2.4 cv=Q6KA4J2a c=1 sm=1 tr=0 ts=66e30eba cx=c_pps a=JZW2CxG2E6UWpsn1SfDs7A==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=EaEq8P2WXUwA:10 a=0034W8JfsZAA:10 a=0kUYKlekyDsA:10 a=64Cc0HZtAAAA:8 a=iaSqmYhzZMJRQdiaQIMA:9 a=14NRyaPF5x3gF6G45PvQ:22 X-Proofpoint-GUID: ByD2ksfgzbDyvhxiDHpfXRheg1qI9X45 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-12_05,2024-09-12_01,2024-09-02_01 X-Proofpoint-Spam-Reason: safe Subject: [ovs-dev] [PATCH ovn v5] 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: , X-Patchwork-Original-From: Mansi Sharma via dev From: Mansi Sharma Reply-To: Mansi Sharma 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 --- v4 -> v5 Optimised tests --- controller/ct-zone.c | 25 ++++++++++ controller/ovn-controller.8.xml | 15 +++++- tests/ovn-controller.at | 86 ++++++++++++++++++++++++++++++--- 3 files changed, 117 insertions(+), 9 deletions(-) diff --git a/controller/ct-zone.c b/controller/ct-zone.c index 77eb16ac9..bd1b0623b 100644 --- a/controller/ct-zone.c +++ b/controller/ct-zone.c @@ -183,6 +183,31 @@ ct_zones_update(const struct sset *local_lports, sset_add(&all_users, local_lport); } + /* Add local_lport 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 *dup_reserve = xstrdup(reserve_ct_zone_request_list); + char *reserve_port; + char *save_ptr = NULL; + + for (reserve_port = strtok_r(dup_reserve, ",", &save_ptr); + reserve_port != NULL; + reserve_port = strtok_r(NULL, ",", &save_ptr)) { + sset_add(&all_users, reserve_port); + } + + free(dup_reserve); + } + } + /* 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..7d07f739e 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -2533,8 +2533,14 @@ check_ovsdb_zone() { test $ct_zone -eq $db_zone } +check_duplicates() { + output=$1 + AT_CHECK([printf "$output" | tr ' ' '\n' | sort | uniq -d | grep .], [1]) +} + 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 +2566,19 @@ 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" - 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]) + +zone_list="$port1_zone $port2_zone $req_port3_zone $req_port4_zone $snat_zone" +check_duplicates "$zone_list" # Now purposely request an SNAT zone for lr0 that conflicts with a zone # currently assigned to a logical port @@ -2585,15 +2593,77 @@ 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="$port1_zone $port2_zone $req_port3_zone $req_port4_zone $snat_zone" +check_duplicates "$zone_list" + +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.