From patchwork Mon Oct 21 00:51:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1180140 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=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46xJF00YTXz9sPV for ; Mon, 21 Oct 2019 11:59:16 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 03288CD3; Mon, 21 Oct 2019 00:52:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp2.linuxfoundation.org (smtp2.linux-foundation.org [172.17.192.36]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 4779ECAE for ; Mon, 21 Oct 2019 00:51:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 55A961DAA7 for ; Mon, 21 Oct 2019 00:51:56 +0000 (UTC) Received: from localhost.localdomain.localdomain (unknown [216.113.160.71]) (Authenticated sender: hzhou@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id BB9B3100006; Mon, 21 Oct 2019 00:51:53 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Sun, 20 Oct 2019 17:51:13 -0700 Message-Id: <1571619079-75503-14-git-send-email-hzhou@ovn.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1571619079-75503-1-git-send-email-hzhou@ovn.org> References: <1571619079-75503-1-git-send-email-hzhou@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp2.linux-foundation.org Cc: Han Zhou Subject: [ovs-dev] [PATCH ovn 13/19] ovn-sb: Add columns is_interconn and is_remote to Chassis. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Support the new columns in Chassis table for OVN interconnection. Also, populate the is_interconn column according to external_ids: is-interconn key of Open_vSwitch table on the chassis. Signed-off-by: Han Zhou --- controller/chassis.c | 14 ++++++++++++++ northd/ovn-northd.c | 6 ++++-- ovn-sb.ovsschema | 8 +++++--- ovn-sb.xml | 15 +++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/controller/chassis.c b/controller/chassis.c index 699b662..47ca75e 100644 --- a/controller/chassis.c +++ b/controller/chassis.c @@ -92,6 +92,8 @@ struct ovs_chassis_cfg { struct sset encap_ip_set; /* Interface type list formatted in the OVN-SB Chassis required format. */ struct ds iface_types; + /* Is this chassis an interconnection gateway. */ + bool is_interconn; }; static void @@ -172,6 +174,12 @@ get_datapath_type(const struct ovsrec_bridge *br_int) return ""; } +static bool +get_is_interconn(const struct smap *ext_ids) +{ + return smap_get_bool(ext_ids, "is-interconn", false); +} + static void update_chassis_transport_zones(const struct sset *transport_zones, const struct sbrec_chassis *chassis_rec) @@ -285,6 +293,8 @@ chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table, sset_destroy(&ovs_cfg->encap_ip_set); } + ovs_cfg->is_interconn = get_is_interconn(&cfg->external_ids); + return true; } @@ -539,6 +549,10 @@ chassis_update(const struct sbrec_chassis *chassis_rec, update_chassis_transport_zones(transport_zones, chassis_rec); + if (ovs_cfg->is_interconn != chassis_rec->is_interconn) { + sbrec_chassis_set_is_interconn(chassis_rec, ovs_cfg->is_interconn); + } + /* If any of the encaps should change, update them. */ bool tunnels_changed = chassis_tunnels_changed(&ovs_cfg->encap_type_set, diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index ccce96a..fd0b081 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -9574,7 +9574,8 @@ check_and_add_supported_dhcpv6_opts_to_sb_db(struct northd_context *ctx) static const char *rbac_chassis_auth[] = {"name"}; static const char *rbac_chassis_update[] = - {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches"}; + {"nb_cfg", "external_ids", "encaps", "vtep_logical_switches", + "is_interconn"}; static const char *rbac_encap_auth[] = {"chassis_name"}; @@ -9772,7 +9773,7 @@ update_northbound_cfg(struct northd_context *ctx, const struct sbrec_chassis *chassis; int64_t hv_cfg = nbg->nb_cfg; SBREC_CHASSIS_FOR_EACH (chassis, ctx->ovnsb_idl) { - if (chassis->nb_cfg < hv_cfg) { + if (!chassis->is_remote && chassis->nb_cfg < hv_cfg) { hv_cfg = chassis->nb_cfg; } } @@ -10059,6 +10060,7 @@ main(int argc, char *argv[]) ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_chassis); ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_nb_cfg); ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_name); + ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_chassis_col_is_remote); ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_ha_chassis); add_column_noalert(ovnsb_idl_loop.idl, diff --git a/ovn-sb.ovsschema b/ovn-sb.ovsschema index 5c013b1..30b622d 100644 --- a/ovn-sb.ovsschema +++ b/ovn-sb.ovsschema @@ -1,7 +1,7 @@ { "name": "OVN_Southbound", - "version": "2.5.0", - "cksum": "1257419092 20387", + "version": "2.6.0", + "cksum": "1645368988 20492", "tables": { "SB_Global": { "columns": { @@ -40,7 +40,9 @@ "min": 0, "max": "unlimited"}}, "transport_zones" : {"type": {"key": "string", "min": 0, - "max": "unlimited"}}}, + "max": "unlimited"}}, + "is_interconn" : {"type": "boolean"}, + "is_remote" : {"type": "boolean"}}, "isRoot": true, "indexes": [["name"]]}, "Encap": { diff --git a/ovn-sb.xml b/ovn-sb.xml index 471310d..b27bb82 100644 --- a/ovn-sb.xml +++ b/ovn-sb.xml @@ -301,6 +301,21 @@ See ovn-controller(8) for more information. + + ovn-controller populates this column with the setting + configured in the column of the Open_vSwitch + database's table. + If set to true, the chassis is used as an interconnection gateway. + See ovn-controller(8) for more information. + + + + ovn-ic set this column true for remote interconnection + gateway chassises learned from the interconnection southbound database. + See ovn-ic(8) for more information. + + ovn-controller populates this key with the set of options configured in the