From patchwork Sun Apr 30 23:22:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 756955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.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 3wGP0R6bBzz9sCX for ; Mon, 1 May 2017 09:29:43 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9994DB76; Sun, 30 Apr 2017 23:23:21 +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 B0222B56 for ; Sun, 30 Apr 2017 23:23:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by smtp2.linuxfoundation.org (Postfix) with ESMTPS id 88FAB1DEE0 for ; Sun, 30 Apr 2017 23:23:19 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by relay8-d.mail.gandi.net (Postfix) with ESMTPS id 0DB39405B6; Mon, 1 May 2017 01:23:18 +0200 (CEST) Received: from mfilter11-d.gandi.net (mfilter11-d.gandi.net [217.70.178.131]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id ECF3641C080; Mon, 1 May 2017 01:23:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter11-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter11-d.gandi.net (mfilter11-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 4NUjE-lVS4rS; Mon, 1 May 2017 01:23:16 +0200 (CEST) X-Originating-IP: 173.228.112.23 Received: from sigabrt.gateway.sonic.net (173-228-112-23.dsl.dynamic.fusionbroadband.com [173.228.112.23]) (Authenticated sender: blp@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 09DE641C07D; Mon, 1 May 2017 01:23:13 +0200 (CEST) From: Ben Pfaff To: dev@openvswitch.org Date: Sun, 30 Apr 2017 16:22:16 -0700 Message-Id: <20170430232231.15151-13-blp@ovn.org> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170430232231.15151-1-blp@ovn.org> References: <20170430232231.15151-1-blp@ovn.org> X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,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: Ben Pfaff Subject: [ovs-dev] [PATCH 12/27] ovn-nbctl: Display and accept Neutron network and router names. 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 The names of these neutron:* keys in external_ids are unfortunate, but they are the keys that the OVN utilities need to support if we want users to be able to work with OpenStack in a convenient fashion rather than having to cut and paste UUIDs everywhere. This commit documents the meaning of these keys, in the hopes that other CMS integrations will simply use them instead of inventing new ones. Perhaps at some point we can clean this up, since bad names are a bad idea, but it also would take a lot of coordination and probably multiple releases. Signed-off-by: Ben Pfaff Acked-by: Andy Zhou --- ovn/ovn-nb.xml | 76 ++++++++++++++++++++++++++++++++++------------- ovn/utilities/ovn-nbctl.c | 27 +++++++++++++---- 2 files changed, 77 insertions(+), 26 deletions(-) diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index 644785dbe83e..834c42acb0de 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -101,15 +101,6 @@ address unknown.

- -

- A name for the logical switch. This name has no special meaning or purpose - other than to provide convenience for human interaction with the ovn-nb - database. There is no requirement for the name to be unique. The - logical switch's UUID should be used as the unique identifier. -

-
-

The logical ports connected to the logical switch. @@ -134,6 +125,33 @@ QOS marking rules that apply to packets within the logical switch. + +

+ These columns provide names for the logical switch. From OVN's + perspective, these names have no special meaning or purpose other than + to provide convenience for human interaction with the database. + There is no requirement for the name to be unique. (For a unique + identifier for a logical switch, use its row UUID.) +

+ +

+ (Originally, was intended to serve the purpose of + a human-friendly name, but the Neutron integration used it to uniquely + identify its own switch object, in the format + neutron-uuid. Later on, Neutron started + propagating the friendly name of a switch as . Perhaps this can be cleaned up someday.) +

+ + + A name for the logical switch. + + + + Another name for the logical switch. + + +

These options control automatic IP address management (IPAM) for ports @@ -1008,15 +1026,6 @@ Each row represents one L3 logical router.

- -

- A name for the logical router. This name has no special meaning or purpose - other than to provide convenience for human interaction with the ovn-nb - database. There is no requirement for the name to be unique. The - logical router's UUID should be used as the unique identifier. -

-
- The router's ports. @@ -1043,6 +1052,33 @@ addresses. Load balancer rules only work on the Gateway routers.
+ +

+ These columns provide names for the logical router. From OVN's + perspective, these names have no special meaning or purpose other than + to provide convenience for human interaction with the northbound + database. There is no requirement for the name to be unique. (For a + unique identifier for a logical router, use its row UUID.) +

+ +

+ (Originally, was intended to serve the purpose of + a human-friendly name, but the Neutron integration used it to uniquely + identify its own router object, in the format + neutron-uuid. Later on, Neutron started + propagating the friendly name of a router as . Perhaps this can be cleaned up someday.) +

+ + + A name for the logical router. + + + + Another name for the logical router. + +
+

Additional options for the logical router. @@ -1168,8 +1204,8 @@

In addition to provide convenience for human interaction with the - ovn-nb database, this column is used as reference by its patch port in - or another logical router port in + northbound database, this column is used as reference by its patch port + in or another logical router port in .

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index cfa1c525f77c..3cae7c548784 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -569,8 +569,14 @@ lb_by_name_or_uuid(struct ctl_context *ctx, const char *id, bool must_exist) static void print_lr(const struct nbrec_logical_router *lr, struct ds *s) { - ds_put_format(s, "router "UUID_FMT" (%s)\n", + ds_put_format(s, "router "UUID_FMT" (%s)", UUID_ARGS(&lr->header_.uuid), lr->name); + const char *neutron_name = smap_get(&lr->external_ids, + "neutron:router_name"); + if (neutron_name) { + ds_put_format(s, " (aka %s)", neutron_name); + } + ds_put_char(s, '\n'); for (size_t i = 0; i < lr->n_ports; i++) { const struct nbrec_logical_router_port *lrp = lr->ports[i]; @@ -606,13 +612,20 @@ print_lr(const struct nbrec_logical_router *lr, struct ds *s) static void print_ls(const struct nbrec_logical_switch *ls, struct ds *s) { - ds_put_format(s, "switch "UUID_FMT" (%s)\n", + ds_put_format(s, "switch "UUID_FMT" (%s)", UUID_ARGS(&ls->header_.uuid), ls->name); + const char *neutron_name = smap_get(&ls->external_ids, + "neutron:network_name"); + if (neutron_name) { + ds_put_format(s, " (aka %s)", neutron_name); + } + ds_put_char(s, '\n'); for (size_t i = 0; i < ls->n_ports; i++) { const struct nbrec_logical_switch_port *lsp = ls->ports[i]; ds_put_format(s, " port %s\n", lsp->name); + if (lsp->type[0]) { ds_put_format(s, " type: %s\n", lsp->type); } @@ -3057,14 +3070,16 @@ cmd_set_ssl(struct ctl_context *ctx) } static const struct ctl_table_class tables[NBREC_N_TABLES] = { - [NBREC_TABLE_LOGICAL_SWITCH].row_ids[0] - = {&nbrec_logical_switch_col_name, NULL, NULL}, + [NBREC_TABLE_LOGICAL_SWITCH].row_ids + = {{&nbrec_logical_switch_col_name, NULL, NULL}, + {&nbrec_logical_switch_col_external_ids, "neutron:network_name", NULL}}, [NBREC_TABLE_LOGICAL_SWITCH_PORT].row_ids[0] = {&nbrec_logical_switch_port_col_name, NULL, NULL}, - [NBREC_TABLE_LOGICAL_ROUTER].row_ids[0] - = {&nbrec_logical_router_col_name, NULL, NULL}, + [NBREC_TABLE_LOGICAL_ROUTER].row_ids + = {{&nbrec_logical_router_col_name, NULL, NULL}, + {&nbrec_logical_router_col_external_ids, "neutron:router_name", NULL}}, [NBREC_TABLE_LOGICAL_ROUTER_PORT].row_ids[0] = {&nbrec_logical_router_port_col_name, NULL, NULL},