[ovs-dev] [PATCH v2 01/13] ovn-northd: Propagate Neutron port names to southbound database.
Ben Pfaff
blp at ovn.org
Wed May 3 15:45:48 UTC 2017
This makes it possible for southbound utilities to use friendlier names,
which will happen in upcoming commits.
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ovn/northd/ovn-northd.c | 13 +++++++++++++
ovn/ovn-nb.xml | 16 ++++++++++++++++
ovn/ovn-sb.ovsschema | 10 +++++++---
ovn/ovn-sb.xml | 23 +++++++++++++++++++++++
4 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 96aad9ae7582..d393e544c308 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1705,6 +1705,9 @@ ovn_port_update_sbrec(const struct ovn_port *op,
sbrec_port_binding_set_parent_port(op->sb, NULL);
sbrec_port_binding_set_tag(op->sb, NULL, 0);
sbrec_port_binding_set_mac(op->sb, NULL, 0);
+
+ struct smap ids = SMAP_INITIALIZER(&ids);
+ sbrec_port_binding_set_external_ids(op->sb, &ids);
} else {
if (strcmp(op->nbsp->type, "router")) {
uint32_t queue_id = smap_get_int(
@@ -1797,6 +1800,14 @@ ovn_port_update_sbrec(const struct ovn_port *op,
sbrec_port_binding_set_tag(op->sb, op->nbsp->tag, op->nbsp->n_tag);
sbrec_port_binding_set_mac(op->sb, (const char **) op->nbsp->addresses,
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);
+ }
+ sbrec_port_binding_set_external_ids(op->sb, &ids);
}
}
@@ -5974,6 +5985,8 @@ main(int argc, char *argv[])
add_column_noalert(ovnsb_idl_loop.idl,
&sbrec_port_binding_col_nat_addresses);
ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_port_binding_col_chassis);
+ add_column_noalert(ovnsb_idl_loop.idl,
+ &sbrec_port_binding_col_external_ids);
ovsdb_idl_add_table(ovnsb_idl_loop.idl, &sbrec_table_mac_binding);
add_column_noalert(ovnsb_idl_loop.idl, &sbrec_mac_binding_col_datapath);
add_column_noalert(ovnsb_idl_loop.idl, &sbrec_mac_binding_col_ip);
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index f127d0df8f8f..383b5b76b569 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -821,6 +821,22 @@
</column>
</group>
+ <group title="Naming">
+ <column name="external_ids" key="neutron:port_name">
+ <p>
+ This column gives an optional human-friendly name for the port. This
+ name has no special meaning or purpose other than to provide
+ convenience for human interaction with the northbound database.
+ </p>
+
+ <p>
+ Neutron copies this from its own port object's name. (Neutron ports
+ do are not assigned human-friendly names by default, so it will often
+ be empty.)
+ </p>
+ </column>
+ </group>
+
<group title="Common Columns">
<column name="external_ids">
See <em>External IDs</em> at the beginning of this document.
diff --git a/ovn/ovn-sb.ovsschema b/ovn/ovn-sb.ovsschema
index 8a39e61051d1..ae248f8a7c4c 100644
--- a/ovn/ovn-sb.ovsschema
+++ b/ovn/ovn-sb.ovsschema
@@ -1,7 +1,7 @@
{
"name": "OVN_Southbound",
- "version": "1.11.0",
- "cksum": "2783500150 10696",
+ "version": "1.12.0",
+ "cksum": "4119465100 10905",
"tables": {
"SB_Global": {
"columns": {
@@ -130,7 +130,11 @@
"max": "unlimited"}},
"nat_addresses": {"type": {"key": "string",
"min": 0,
- "max": "unlimited"}}},
+ "max": "unlimited"}},
+ "external_ids": {"type": {"key": "string",
+ "value": "string",
+ "min": 0,
+ "max": "unlimited"}}},
"indexes": [["datapath", "tunnel_key"], ["logical_port"]],
"isRoot": true},
"MAC_Binding": {
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index b92c2d065608..8bb0f3ddebc9 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -2129,6 +2129,29 @@ tcp.flags = RST;
</p>
</column>
</group>
+
+ <group title="Naming">
+ <column name="external_ids" key="name">
+ <p>
+ For a logical switch port, <code>ovn-northd</code> copies this from
+ <ref table="Logical_Switch_Port" db="OVN_Northbound"
+ column="external_ids" key="neutron:port_name"/> in the <ref
+ table="Logical_Switch_Port" db="OVN_Northbound"/> table in the
+ OVN_Northbound database, if it is a nonempty string.
+ </p>
+
+ <p>
+ For a logical switch port, <code>ovn-northd</code> does not currently
+ set this key.
+ </p>
+ </column>
+ </group>
+
+ <group title="Common Columns">
+ <column name="external_ids">
+ See <em>External IDs</em> at the beginning of this document.
+ </column>
+ </group>
</table>
<table name="MAC_Binding" title="IP to MAC bindings">
--
2.10.2
More information about the dev
mailing list