This makes it possible for southbound utilities to use friendlier names, which will happen in upcoming commits.
Signed-off-by: Ben Pfaff <b...@ovn.org> --- ovn/northd/ovn-northd.c | 13 +++++++++++++ ovn/ovn-nb.xml | 16 ++++++++++++++++ ovn/ovn-sb.ovsschema | 8 ++++++-- ovn/ovn-sb.xml | 23 +++++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index d0a5ba200bc4..6f439c5676b2 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1702,6 +1702,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( @@ -1794,6 +1797,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); } } @@ -5803,6 +5814,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 834c42acb0de..f82eb3e1e497 100644 --- a/ovn/ovn-nb.xml +++ b/ovn/ovn-nb.xml @@ -815,6 +815,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 a576dc4f3bf2..371cad2b9eb7 100644 --- a/ovn/ovn-sb.ovsschema +++ b/ovn/ovn-sb.ovsschema @@ -1,7 +1,7 @@ { "name": "OVN_Southbound", "version": "1.10.0", - "cksum": "860871483 9898", + "cksum": "3551312875 10107", "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 5542f7ee2f1a..3c93320a1b76 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -2082,6 +2082,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 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev