[openstack-dev] [PATCH v4 2/5] ovn: Add bridge mappings to ovn-controller.

Russell Bryant rbryant at redhat.com
Fri Jul 31 17:11:35 UTC 2015


I found a couple of problems in this one.  I'll fix it in v5 in a few
minutes.

On 07/31/2015 10:52 AM, Russell Bryant wrote:
> Add a new OVN configuration entry in the Open_vSwitch database called
> "ovn-bridge-mappings".  This allows the configuration of mappings
> between a physical network name and an OVS bridge that provides
> connectivity to that network.
> 
> For example, if you wanted to configure "physnet1" to map to "br-eth0"
> and "physnet2" to map to "br-eth1", the configuration would be:
> 
>   $ ovs-vsctl set open . \
>   > external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1
> 
> Patch ports between these bridges and the integration bridge are
> automatically created and also removed if necessary when the
> configuration changes.
> 
> Documentation for this configuration value is introduced in a later
> patch that makes use of this by introducing a "localnet" logical port
> type.
> 
> Signed-off-by: Russell Bryant <rbryant at redhat.com>
> +static void
> +create_patch_port(struct controller_ctx *ctx,
> +                  const char *network,
> +                  const struct ovsrec_bridge *b1,
> +                  const struct ovsrec_bridge *b2)
> +{
> +    struct ovsrec_interface *iface;
> +    struct ovsrec_port *port, **ports;
> +    size_t i;
> +    char *port_name;
> +
> +    port_name = xasprintf("patch-%s-to-%s", b1->name, b2->name);
> +
> +    ovsdb_idl_txn_add_comment(ctx->ovs_idl_txn,
> +            "ovn-controller: creating patch port '%s' from '%s' to '%s'",
> +            port_name, b1->name, b2->name);

This will blow up if ctx->ovs_idl_txn is NULL, which happens under
normal cirumstances.


> @@ -271,6 +495,10 @@ main(int argc, char *argv[])
>          const struct ovsrec_bridge *br_int = get_br_int(ctx.ovs_idl);
>          const char *chassis_id = get_chassis_id(ctx.ovs_idl);
>  
> +        /* Map bridges to local nets from ovn-bridge-mappings */
> +        struct smap bridge_mappings = SMAP_INITIALIZER(&bridge_mappings);
> +        init_bridge_mappings(&ctx, br_int, &bridge_mappings);
> +

This should make sure br_int isn't NULL first.

-- 
Russell Bryant



More information about the OpenStack-dev mailing list