[ovs-dev] [PATCH 3/3] ovn: Add ovn-bridge-mappings to Chassis external_ids.

Ben Pfaff blp at ovn.org
Mon Mar 28 21:01:42 UTC 2016


On Mon, Mar 28, 2016 at 03:52:17PM -0400, Russell Bryant wrote:
> Publish ovn-controller's local bridge mappings configuration
> in the external_ids column of the Chassis table.  Having this
> information available for reading is useful to applications
> integrating with OVN.
> 
> Signed-off-by: Russell Bryant <russell at ovn.org>

"external-ids" is usually a column that different applications should
share.  I think that's the intent here, because the code modifies the
existing contents of the column rather than replacing it wholesale, but
to ensure atomic transactional behavior, the code should ensure that the
column hasn't changed since it was read, by calling
sbrec_chassis_verify_externals_ids() before it sets it, e.g. just before
the sbrec_chassis_set_external_ids() call below:

> +        const char *chassis_bridge_mappings
> +            = smap_get(&chassis_rec->external_ids, "ovn-bridge-mappings");
> +        if (!chassis_bridge_mappings) {
> +            chassis_bridge_mappings = "";
> +        }
> +        if (strcmp(bridge_mappings, chassis_bridge_mappings)) {
> +            struct smap new_ids;
> +            smap_clone(&new_ids, &chassis_rec->external_ids);
> +            smap_replace(&new_ids, "ovn-bridge-mappings", bridge_mappings);
> +            sbrec_chassis_set_external_ids(chassis_rec, &new_ids);
> +            smap_destroy(&new_ids);
> +        }
> +

Also, s/applicatoins/applications/ here:

> +    <column name="external_ids" key="ovn-bridge-mappings">
> +      <code>ovn-controller</code> populates this key with the set of bridge
> +      mappings it has been configured to use.  Other applicatoins should treat
> +      this key as read-only.  See <code>ovn-controller</code>(8) for more
> +      information.
> +    </column>



More information about the dev mailing list