[ovs-dev] [PATCH ovn v2] controller: Set chassis for container port.

Justin Pettit jpettit at nicira.com
Wed May 6 22:30:59 UTC 2015


Thanks!  I pushed it to "ovn".

--Justin


> On May 5, 2015, at 7:30 PM, Russell Bryant <rbryant at redhat.com> wrote:
> 
> ovn-controller updates the chassis column of the Bindings table in
> OVN_Southbound when a logical port appears on the local switch.  A
> logical port that has a parent will never appear on a switch managed
> by ovn-controller.  When a parent port appears, all child container
> ports should be updated as being on that chassis, as well.
> 
> Signed-off-by: Russell Bryant <rbryant at redhat.com>
> ---
> ovn/controller/bindings.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
> 
> 
> v1->v2
> - Applied suggestions from Justin.
> 
> 
> diff --git a/ovn/controller/bindings.c b/ovn/controller/bindings.c
> index ef233c0..e5b4827 100644
> --- a/ovn/controller/bindings.c
> +++ b/ovn/controller/bindings.c
> @@ -76,12 +76,14 @@ bindings_run(struct controller_ctx *ctx)
> {
>     const struct sbrec_bindings *bindings_rec;
>     struct ovsdb_idl_txn *txn;
> -    struct sset lports;
> +    struct sset lports, all_lports;
>     const char *name;
>     int retval;
> 
>     sset_init(&lports);
> +    sset_init(&all_lports);
>     get_local_iface_ids(ctx, &lports);
> +    sset_clone(&all_lports, &lports);
> 
>     txn = ovsdb_idl_txn_create(ctx->ovnsb_idl);
>     ovsdb_idl_txn_add_comment(txn,
> @@ -89,7 +91,9 @@ bindings_run(struct controller_ctx *ctx)
>                               ctx->chassis_id);
> 
>     SBREC_BINDINGS_FOR_EACH(bindings_rec, ctx->ovnsb_idl) {
> -        if (sset_find_and_delete(&lports, bindings_rec->logical_port)) {
> +        if (sset_find_and_delete(&lports, bindings_rec->logical_port) ||
> +                (bindings_rec->parent_port && bindings_rec->parent_port[0] &&
> +                 sset_contains(&all_lports, bindings_rec->parent_port))) {
>             if (!strcmp(bindings_rec->chassis, ctx->chassis_id)) {
>                 continue;
>             }
> @@ -116,6 +120,7 @@ bindings_run(struct controller_ctx *ctx)
>         VLOG_DBG("No binding record for lport %s", name);
>     }
>     sset_destroy(&lports);
> +    sset_destroy(&all_lports);
> }
> 
> void
> -- 
> 2.1.0
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list