From patchwork Wed Aug 11 08:37:27 2021
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Frode Nordahl
X-Patchwork-Id: 1515650
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org
(client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=)
Authentication-Results: ozlabs.org;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=canonical.com header.i=@canonical.com
header.a=rsa-sha256 header.s=20210705 header.b=TYZ7Tqgy;
dkim-atps=neutral
Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest
SHA256)
(No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 4Gl39m4mmYz9sT6
for ; Wed, 11 Aug 2021 18:38:04 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id 33A27404C7;
Wed, 11 Aug 2021 08:38:01 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from smtp2.osuosl.org ([127.0.0.1])
by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id gtfvNQDbPvtB; Wed, 11 Aug 2021 08:37:56 +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 E6F3740491;
Wed, 11 Aug 2021 08:37:52 +0000 (UTC)
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id 5DD0DC0021;
Wed, 11 Aug 2021 08:37:52 +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 8CE23C000E
for ; Wed, 11 Aug 2021 08:37:48 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp3.osuosl.org (Postfix) with ESMTP id A8BC460716
for ; Wed, 11 Aug 2021 08:37:47 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Authentication-Results: smtp3.osuosl.org (amavisd-new);
dkim=pass (2048-bit key) header.d=canonical.com
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 xy1E4yzChZHK for ;
Wed, 11 Aug 2021 08:37:43 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0
Received: from smtp-relay-canonical-0.canonical.com
(smtp-relay-canonical-0.canonical.com [185.125.188.120])
by smtp3.osuosl.org (Postfix) with ESMTPS id 1AD6260787
for ; Wed, 11 Aug 2021 08:37:42 +0000 (UTC)
Received: from frode-threadripper.. (ti0189a330-1161.bb.online.no
[88.88.219.141])
(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 smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id C831C3F110
for ; Wed, 11 Aug 2021 08:37:34 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;
s=20210705; t=1628671054;
bh=SlfrHAJb+KYOu/PWIxFcmn16HfllFx8oVeCvmdJ2jHg=;
h=From:To:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version;
b=TYZ7TqgyRCL6xil+fn9/OqI4vqPvr1WzcrgsnP1MaEDNGv6H8LFx0cQXwwnOjLv5g
ljdaIS/kmSUKBRJbjXNkOyvfeBmCE3Dksg550yiKq81fc3CglbHgVndkd+D+s1Xitc
lsi51c+CnTBSTsG1IEPhyA1eHqsRPTTm3WVx9YqIc1FhDHbxQUo3n+rXXead+jT5eH
n7j3bV/bGi7ZVMUKsa/jM9qT8TzQQv5LSB11KGInq3ME25/CtVDOwFQ46WiEIoLWe0
LXxk38V+amdDenUgl8UxYHlqmddHTyZ1iQUSpgCpfP78dYgJ/6MgxN2PGYoxapfpXh
QnVCGQr906GEQ==
From: Frode Nordahl
To: dev@openvswitch.org
Date: Wed, 11 Aug 2021 10:37:27 +0200
Message-Id: <20210811083732.846324-2-frode.nordahl@canonical.com>
X-Mailer: git-send-email 2.31.1
In-Reply-To: <20210811083732.846324-1-frode.nordahl@canonical.com>
References: <20210811083732.846324-1-frode.nordahl@canonical.com>
MIME-Version: 1.0
Subject: [ovs-dev] [PATCH ovn 1/6] ovn-sb: Add plugged_by column to
Port_Binding.
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"
To allow for use of optional plugging support we add a new
plugged_by column with weakRef to the Chassis table. The
ovn-controller can monitor this column and only process events
for its chassis UUID.
ovn-northd will fill this column with UUID of Chassis referenced
in Logical_Switch_Port options:requested-chassis when
options:plug-type is defined.
Signed-off-by: Frode Nordahl
---
northd/ovn-northd.c | 31 ++++++++++++++++++++++++++++++
ovn-nb.xml | 38 ++++++++++++++++++++++++++++++++++++
ovn-sb.ovsschema | 10 +++++++---
ovn-sb.xml | 15 +++++++++++++++
tests/ovn-northd.at | 47 +++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 138 insertions(+), 3 deletions(-)
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 4c164a744..3ab296081 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -3164,6 +3164,35 @@ ovn_port_update_sbrec(struct northd_context *ctx,
* ha_chassis_group cleared in the same transaction. */
sbrec_port_binding_set_ha_chassis_group(op->sb, NULL);
}
+
+ const char *plug_type; /* May be NULL. */
+ const char *requested_chassis; /* May be NULL. */
+ bool reset_plugged_by = false;
+ plug_type = smap_get(&op->nbsp->options, "plug-type");
+ requested_chassis = smap_get(&op->nbsp->options,
+ "requested-chassis");
+ if (plug_type && requested_chassis) {
+ const struct sbrec_chassis *chassis; /* May be NULL. */
+ chassis = chassis_lookup_by_name(sbrec_chassis_by_name,
+ requested_chassis);
+ if (chassis) {
+ sbrec_port_binding_set_plugged_by(op->sb, chassis);
+ } else {
+ reset_plugged_by = true;
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(
+ 1, 1);
+ VLOG_WARN_RL(
+ &rl,
+ "Unknown chassis '%s' set as "
+ "options:requested-chassis on LSP '%s'.",
+ requested_chassis, op->nbsp->name);
+ }
+ } else if (op->sb->plugged_by) {
+ reset_plugged_by = true;
+ }
+ if (reset_plugged_by) {
+ sbrec_port_binding_set_plugged_by(op->sb, NULL);
+ }
} else {
const char *chassis = NULL;
if (op->peer && op->peer->od && op->peer->od->nbr) {
@@ -14901,6 +14930,8 @@ main(int argc, char *argv[])
add_column_noalert(ovnsb_idl_loop.idl,
&sbrec_port_binding_col_nat_addresses);
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_port_binding_col_chassis);
+ ovsdb_idl_add_column(ovnsb_idl_loop.idl,
+ &sbrec_port_binding_col_plugged_by);
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
&sbrec_port_binding_col_gateway_chassis);
ovsdb_idl_add_column(ovnsb_idl_loop.idl,
diff --git a/ovn-nb.xml b/ovn-nb.xml
index c1176e81f..d2cf3a984 100644
--- a/ovn-nb.xml
+++ b/ovn-nb.xml
@@ -1020,6 +1020,44 @@
DHCP reply.
+
+
+
+ These options apply to logical ports with
+ and
+ set.
+
+
+
+ If set, OVN will attempt to to perform plugging of this VIF. In
+ order to get this port plugged by the OVN controller, OVN must be
+ built with support for VIF plugging. The default behavior is for
+ the CMS to do the VIF plugging.
+ Supported values: representor
+
+
+
+ MAC address for identifying PF device. When
+ is also set, this
+ option is used to identify PF to use as base to locate the correct
+ VF representor port. When
+ is not set this
+ option is used to locate a PF representor port.
+
+
+
+ Logical VF number relative to PF device specified in
+ .
+
+
+
+ Requested MTU for plugged interfaces. When set the OVN controller
+ will fill the column
+ of the Open vSwitch database's
+ table. This in turn will
+ make OVS vswitchd update the MTU of the linked interface.
+
+
diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema
index e5ab41db9..4df326ff4 100644
--- a/ovn-sb.ovsschema
+++ b/ovn-sb.ovsschema
@@ -1,7 +1,7 @@
{
"name": "OVN_Southbound",
- "version": "20.20.0",
- "cksum": "605270161 26670",
+ "version": "20.21.0",
+ "cksum": "888060012 26935",
"tables": {
"SB_Global": {
"columns": {
@@ -232,7 +232,11 @@
"external_ids": {"type": {"key": "string",
"value": "string",
"min": 0,
- "max": "unlimited"}}},
+ "max": "unlimited"}},
+ "plugged_by": {"type": {"key": {"type": "uuid",
+ "refTable": "Chassis",
+ "refType": "weak"},
+ "min": 0, "max": 1}}},
"indexes": [["datapath", "tunnel_key"], ["logical_port"]],
"isRoot": true},
"MAC_Binding": {
diff --git a/ovn-sb.xml b/ovn-sb.xml
index f3b6307e3..281334cbc 100644
--- a/ovn-sb.xml
+++ b/ovn-sb.xml
@@ -2983,6 +2983,21 @@ tcp.flags = RST;
+
+ Chassis that should plug this port, this column must be a
+ record. This is populated by
+ ovn-northd
when the and is defined. In order to get this port plugged by
+ the OVN controller, OVN must be built with support for VIF plugging.
+ The default behavior is for the CMS to do the VIF plugging.
+
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index d4d3c9b65..27a530833 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -5029,3 +5029,50 @@ AT_CHECK([grep -e "lr_in_ip_routing_ecmp" lr0flows | sed 's/192\.168\.0\..0/192.
AT_CLEANUP
])
+
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([check requested-chassis and plug-type fills plugged_by col])
+AT_KEYWORDS([plugging])
+ovn_start NORTHD_TYPE
+
+# Add chassis ch1.
+check ovn-sbctl chassis-add ch1 geneve 127.0.0.2
+check ovn-sbctl chassis-add ch2 geneve 127.0.0.3
+check ovn-sbctl chassis-add ch3 geneve 127.0.0.4
+
+wait_row_count Chassis 3
+
+ch1_uuid=`ovn-sbctl --bare --columns _uuid find Chassis name="ch1"`
+ch2_uuid=`ovn-sbctl --bare --columns _uuid find Chassis name="ch2"`
+ch3_uuid=`ovn-sbctl --bare --columns _uuid find Chassis name="ch3"`
+
+ovn-nbctl ls-add S1
+ovn-nbctl --wait=sb lsp-add S1 S1-vm1
+
+ovn-nbctl --wait=sb set logical_switch_port S1-vm1 \
+ options:requested-chassis=ch1
+
+wait_row_count Port_Binding 1 logical_port=S1-vm1 plugged_by!=$ch1_uuid
+
+ovn-nbctl --wait=sb set logical_switch_port S1-vm1 \
+ options:plug-type=representor
+
+wait_row_count Port_Binding 1 logical_port=S1-vm1 plugged_by=$ch1_uuid
+
+ovn-nbctl --wait=sb set logical_switch_port S1-vm1 \
+ options:requested-chassis=ch2 options:plug-type=representor
+
+wait_row_count Port_binding 1 logical-port=S1-vm1 plugged_by=$ch2_uuid
+
+ovn-nbctl --wait=sb set logical_switch_port S1-vm1 \
+ options:requested-chassis=ch3 options:plug-type=representor
+
+wait_row_count Port_binding 1 logical-port=S1-vm1 plugged_by=$ch3_uuid
+
+ovn-nbctl --wait=sb remove logical_switch_port S1-vm1 \
+ options plug-type=representor
+
+wait_row_count Port_binding 1 logical-port=S1-vm1 plugged_by!=$ch3_uuid
+
+AT_CLEANUP
+])