From patchwork Sun Aug 14 22:24:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 659074 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 3sCCqN6dPBz9t0m for ; Mon, 15 Aug 2016 08:25:04 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 4B1B9106C8; Sun, 14 Aug 2016 15:24:39 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id C354D106AC for ; Sun, 14 Aug 2016 15:24:35 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 5D078163188 for ; Sun, 14 Aug 2016 16:24:35 -0600 (MDT) X-ASG-Debug-ID: 1471213474-0b3237593f3b560001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar6.cudamail.com with ESMTP id 7vmGkecT4Yx1wLVP (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 14 Aug 2016 16:24:34 -0600 (MDT) X-Barracuda-Envelope-From: blp@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO relay3-d.mail.gandi.net) (217.70.183.195) by mx3-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 14 Aug 2016 22:24:34 -0000 Received-SPF: pass (mx3-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.195 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.195 X-Barracuda-RBL-IP: 217.70.183.195 Received: from mfilter27-d.gandi.net (mfilter27-d.gandi.net [217.70.178.155]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 7E28CA80C8; Mon, 15 Aug 2016 00:24:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter27-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter27-d.gandi.net (mfilter27-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 5oTAqMcdIOlP; Mon, 15 Aug 2016 00:24:32 +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 relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0080BA80CB; Mon, 15 Aug 2016 00:24:30 +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-V2-813014051 X-CudaMail-DTE: 081416 X-CudaMail-Originating-IP: 217.70.183.195 Date: Sun, 14 Aug 2016 15:24:19 -0700 X-ASG-Orig-Subj: [##CM-V2-813014051##][PATCH v5 5/8] ovn-northd: Copy name in logical datapath southbound representations. Message-Id: <1471213462-22329-6-git-send-email-blp@ovn.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1471213462-22329-1-git-send-email-blp@ovn.org> References: <1471213462-22329-1-git-send-email-blp@ovn.org> X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1471213474 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 v5 5/8] 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 Acked-by: Ryan Moats Acked-by: Justin Pettit --- 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 1bb0430..ede92ab 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 0829cbc..1da309c 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -1524,6 +1524,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 fb340fb..b894b8b 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[] = { @@ -719,9 +721,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; }