On Wed, May 3, 2017 at 8:45 AM, Ben Pfaff <[email protected]> wrote:
> 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]>
> ---
> 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);
> }
In the definition of both nbrec_loical_router and
nbrec_logical_switch, the comment of the 'name' filed
says it should nonnull. If that is true, then we don't need this check?
> + 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
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev