[ovs-dev] [PATCH v2 02/13] ovn-northd: Propagate Neutron datapath names to southbound database.
Ben Pfaff
blp at ovn.org
Wed May 3 15:45:49 UTC 2017
It's much easier to see what's going on in the southbound database if
human-friendly names are available.
Really it's too bad that we didn't put the human-friendly name in "name"
and the UUID in something like "external_ids:neutron-uuid", but it'll take
more coordination to change that at this point and it may not be worth it.
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ovn/northd/ovn-northd.c | 10 +++++++++-
ovn/ovn-sb.xml | 28 ++++++++++++++++++++++------
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index d393e544c308..3680433d26fa 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -725,8 +725,13 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths)
sprintf(uuid_s, UUID_FMT, UUID_ARGS(&od->key));
const char *key = od->nbs ? "logical-switch" : "logical-router";
- /* Get name to set in external-ids. */
+ /* Get names to set in external-ids. */
const char *name = od->nbs ? od->nbs->name : od->nbr->name;
+ const char *name2 = (od->nbs
+ ? smap_get(&od->nbs->external_ids,
+ "neutron:network_name")
+ : smap_get(&od->nbr->external_ids,
+ "neutron:router_name"));
/* Set external-ids. */
struct smap ids = SMAP_INITIALIZER(&ids);
@@ -734,6 +739,9 @@ build_datapaths(struct northd_context *ctx, struct hmap *datapaths)
if (*name) {
smap_add(&ids, "name", name);
}
+ if (name2 && name2[0]) {
+ smap_add(&ids, *name ? "name2" : "name", name2);
+ }
sbrec_datapath_binding_set_external_ids(od->sb, &ids);
smap_destroy(&ids);
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 8bb0f3ddebc9..387adb8069d3 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -1691,12 +1691,28 @@ tcp.flags = RST;
the <ref db="OVN_Northbound"/> database.
</column>
- <column name="external_ids" key="name">
- <code>ovn-northd</code> copies this from the <ref
- table="Logical_Router" db="OVN_Northbound"/> or <ref
- table="Logical_Switch" db="OVN_Northbound"/> table in the <ref
- db="OVN_Northbound"/> database, when that column is nonempty.
- </column>
+ <group title="Naming">
+ <p>
+ <code>ovn-northd</code> copies these from the name fields in the <ref
+ db="OVN_Northbound"/> database, either from <ref
+ table="Logical_Router" db="OVN_Northbound" column="name"/> and <ref
+ table="Logical_Router" db="OVN_Northbound" column="external_ids"
+ key="neutron:router_name"/> in the <ref table="Logical_Router"
+ db="OVN_Northbound"/> table or from <ref table="Logical_Switch"
+ db="OVN_Northbound" column="name"/> and <ref table="Logical_Switch"
+ db="OVN_Northbound" column="external_ids"
+ key="neutron:network_name"/> in the <ref table="Logical_Switch"
+ db="OVN_Northbound"/> table.
+ </p>
+
+ <column name="external_ids" key="name">
+ A name for the logical datapath.
+ </column>
+
+ <column name="external_ids" key="name2">
+ Another name for the logical datapath.
+ </column>
+ </group>
</group>
<group title="Common Columns">
--
2.10.2
More information about the dev
mailing list