diff options
author | Ben Pfaff <blp@ovn.org> | 2017-04-30 14:26:58 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-05-03 16:18:43 -0700 |
commit | 4a680bffcd9b263c20409260faad16370c71655e (patch) | |
tree | c5cacfa1b2d60e001bdff878e48d65f9ea77a0f8 /ovn | |
parent | 56ec5593b4717d32ea591861b086facc7cd97b4a (diff) | |
download | openvswitch-4a680bffcd9b263c20409260faad16370c71655e.tar.gz |
ovn-northd: Propagate Neutron port names to southbound database.
This makes it possible for southbound utilities to use friendlier names,
which will happen in upcoming commits.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Diffstat (limited to 'ovn')
-rw-r--r-- | ovn/northd/ovn-northd.c | 13 | ||||
-rw-r--r-- | ovn/ovn-nb.xml | 16 | ||||
-rw-r--r-- | ovn/ovn-sb.ovsschema | 10 | ||||
-rw-r--r-- | 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 96aad9ae7..d393e544c 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 f127d0df8..383b5b76b 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 8a39e6105..ae248f8a7 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 b92c2d065..8bb0f3dde 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"> |