From patchwork Mon Aug 8 07:45:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 656600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3s78g50y4sz9t0F for ; Mon, 8 Aug 2016 17:48:49 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 3AE0710759; Mon, 8 Aug 2016 00:45:54 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 444EC105B2 for ; Mon, 8 Aug 2016 00:45:52 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id D3D674204B1 for ; Mon, 8 Aug 2016 01:45:51 -0600 (MDT) X-ASG-Debug-ID: 1470642351-09eadd5e8542ac30001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar5.cudamail.com with ESMTP id Xi2THo1Oe1undOa3 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 08 Aug 2016 01:45:51 -0600 (MDT) X-Barracuda-Envelope-From: blp@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO relay4-d.mail.gandi.net) (217.70.183.196) by mx3-pf3.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 8 Aug 2016 07:45:51 -0000 Received-SPF: pass (mx3-pf3.cudamail.com: SPF record at ovn.org designates 217.70.183.196 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.196 X-Barracuda-RBL-IP: 217.70.183.196 Received: from mfilter31-d.gandi.net (mfilter31-d.gandi.net [217.70.178.162]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id AA5F71720A4; Mon, 8 Aug 2016 09:45:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter31-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter31-d.gandi.net (mfilter31-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id ctuDMe2KIPGm; Mon, 8 Aug 2016 09:45:48 +0200 (CEST) X-Originating-IP: 173.228.112.241 Received: from sigabrt.gateway.sonic.net (173-228-112-241.dsl.dynamic.fusionbroadband.com [173.228.112.241]) (Authenticated sender: blp@ovn.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 7EB7F17209B; Mon, 8 Aug 2016 09:45:47 +0200 (CEST) X-CudaMail-Envelope-Sender: blp@ovn.org From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-807000745 X-CudaMail-DTE: 080816 X-CudaMail-Originating-IP: 217.70.183.196 Date: Mon, 8 Aug 2016 00:45:06 -0700 X-ASG-Orig-Subj: [##CM-V3-807000745##][PATCH 27/30] ovn-northd: Copy name in logical datapath southbound representations. Message-Id: <1470642309-18995-28-git-send-email-blp@ovn.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1470642309-18995-1-git-send-email-blp@ovn.org> References: <1470642309-18995-1-git-send-email-blp@ovn.org> X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1470642351 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 27/30] ovn-northd: Copy name in logical datapath southbound representations. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" This makes it easier to debug based on the southbound database without looking at the northbound representation. This commit adds the name to "ovn-sbctl dump-flows" output and it will be even more useful in an upcoming commit. Signed-off-by: Ben Pfaff --- ovn/northd/ovn-northd.c | 16 ++++++++++++++-- ovn/ovn-sb.xml | 7 +++++++ ovn/utilities/ovn-sbctl.c | 10 +++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 292df05..7585ee0 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -518,11 +518,23 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths) od->sb = sbrec_datapath_binding_insert(ctx->ovnsb_txn); + /* Get the logical-switch or logical-router UUID to set in + * external-ids. */ char uuid_s[UUID_LEN + 1]; sprintf(uuid_s, UUID_FMT, UUID_ARGS(&od->key)); const char *key = od->nbs ? "logical-switch" : "logical-router"; - const struct smap id = SMAP_CONST1(&id, key, uuid_s); - sbrec_datapath_binding_set_external_ids(od->sb, &id); + + /* Get name to set in external-ids. */ + const char *name = od->nbs ? od->nbs->name : od->nbr->name; + + /* Set external-ids. */ + struct smap ids = SMAP_INITIALIZER(&ids); + smap_add(&ids, key, uuid_s); + if (*name) { + smap_add(&ids, "name", name); + } + sbrec_datapath_binding_set_external_ids(od->sb, &ids); + smap_destroy(&ids); sbrec_datapath_binding_set_tunnel_key(od->sb, tunnel_key); } diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml index 1796253..208dcbf 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -1425,6 +1425,13 @@ tcp.flags = RST; corresponding row in the database. + + + ovn-northd copies this from the or table in the database, when that column is nonempty. + diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c index 11d4c52..a971b42 100644 --- a/ovn/utilities/ovn-sbctl.c +++ b/ovn/utilities/ovn-sbctl.c @@ -489,6 +489,8 @@ pre_get_info(struct ctl_context *ctx) ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_table_id); ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_match); ovsdb_idl_add_column(ctx->idl, &sbrec_logical_flow_col_external_ids); + + ovsdb_idl_add_column(ctx->idl, &sbrec_datapath_binding_col_external_ids); } static struct cmd_show_table cmd_show_tables[] = { @@ -717,9 +719,11 @@ cmd_lflow_list(struct ctl_context *ctx) continue; } if (strcmp(cur_pipeline, lflow->pipeline)) { - printf("Datapath: " UUID_FMT " Pipeline: %s\n", - UUID_ARGS(&lflow->logical_datapath->header_.uuid), - lflow->pipeline); + printf("Datapath: \"%s\" ("UUID_FMT") Pipeline: %s\n", + smap_get_def(&lflow->logical_datapath->external_ids, + "name", ""), + UUID_ARGS(&lflow->logical_datapath->header_.uuid), + lflow->pipeline); cur_pipeline = lflow->pipeline; }