Skip to content

Commit

Permalink
ovn-northd: Propagate Neutron datapath names to southbound database.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Andy Zhou <[email protected]>
  • Loading branch information
blp committed May 3, 2017
1 parent 4a680bf commit cacc55a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
12 changes: 9 additions & 3 deletions ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,20 @@ 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);
smap_add(&ids, key, uuid_s);
if (*name) {
smap_add(&ids, "name", name);
smap_add(&ids, "name", name);
if (name2 && name2[0]) {
smap_add(&ids, "name2", name2);
}
sbrec_datapath_binding_set_external_ids(od->sb, &ids);
smap_destroy(&ids);
Expand Down
28 changes: 22 additions & 6 deletions ovn/ovn-sb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit cacc55a

Please sign in to comment.