From patchwork Mon Jun 5 15:13:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Alvarez Sanchez X-Patchwork-Id: 771297 X-Patchwork-Delegate: rbryant@redhat.com 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 3whJJX2wKkz9s3s for ; Tue, 6 Jun 2017 01:14:36 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0CD5AB30; Mon, 5 Jun 2017 15:14:32 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 0F9F7901 for ; Mon, 5 Jun 2017 15:14:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AAFBB17B for ; Mon, 5 Jun 2017 15:14:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04C02C049D5B for ; Mon, 5 Jun 2017 15:14:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 04C02C049D5B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dalvarez@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 04C02C049D5B Received: from devstack.novalocal (unknown [10.16.19.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F7157A2EB; Mon, 5 Jun 2017 15:14:27 +0000 (UTC) From: Daniel Alvarez To: dev@openvswitch.org Date: Mon, 5 Jun 2017 15:13:27 +0000 Message-Id: <1496675607-28619-1-git-send-email-dalvarez@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Jun 2017 15:14:29 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] Copy external_ids from Logical_Switch_Port to SB database 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 This patch makes ovn-northd copy all string-string pairs in external_ids column of the Logical_Switch_Port table in Northbound database to the equivalent column of the Port_Binding table in Southbound database. OpenStack Neutron will add some useful data to NB database that can be later read by networking-ovn-metadata-agent without the need of maintaining a connection to NB database. This data would include the CIDR's of a port or the project and device ID's which are needed when talking to Nova to request metadata. --- ovn/northd/ovn-northd.c | 11 +++++++---- ovn/ovn-nb.xml | 11 ++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 5914988..a063a05 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1814,10 +1814,13 @@ ovn_port_update_sbrec(const struct ovn_port *op, op->nbsp->n_addresses); struct smap ids = SMAP_INITIALIZER(&ids); - const char *name = smap_get(&op->nbsp->external_ids, - "neutron:port_name"); - if (name && name[0]) { - smap_add(&ids, "name", name); + smap_clone(&ids, &op->nbsp->external_ids); + const char *name = smap_get(&ids, "neutron:port_name"); + if (name) { + smap_remove(&ids, "neutron:port_name"); + if (name[0]) { + smap_add(&ids, "name", name); + } } sbrec_port_binding_set_external_ids(op->sb, &ids); } diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml index eb348fe..7bb322f 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -848,7 +848,16 @@ - See External IDs at the beginning of this document. +

+ See External IDs at the beginning of this document. +

+ +

+ The ovn-northd program copies all these pairs into the + column of the + table in + database. +