On Mon, Aug 1, 2016 at 1:30 PM, Russell Bryant <russ...@ovn.org> wrote:
> > > On Mon, Aug 1, 2016 at 12:09 PM, Russell Bryant <russ...@ovn.org> wrote: > >> >> >> On Mon, Aug 1, 2016 at 12:00 PM, Ben Pfaff <b...@ovn.org> wrote: >> >>> On Mon, Aug 01, 2016 at 02:55:26AM -0700, nickcooper-zhangtonghao wrote: >>> > If the chassis doesn't configure the >>> 'external-ids:ovn-bridge-mappings' in >>> > the OVSDB, the 'add_bridge_mappings' should return directly. >>> > >>> > Signed-off-by: nickcooper-zhangtonghao >>> <nickcooper-zhangtong...@opencloud.tech> >>> >>> What's the benefit? >> >> >> I was looking at this earlier before I got on some calls. >> >> There doesn't appear to be any bug here, but this patch does skip some >> unnecessary code. The most notable improvement seems to be skipping a loop >> over all Port_Binding records in every call to patch_run. >> > > Acked-by: Russell Bryant <russ...@ovn.org> > I went ahead and applied this to master with a minor addition to the commit message and a change to also return on an empty string. I also dropped the new comment, as I think the code is obvious enough. The final patch is here: commit c13fb2b804e9fb2c9524ed6f54d84324e2d219dc Author: nickcooper-zhangtonghao <nickcooper-zhangtong...@opencloud.tech> Date: Mon Aug 1 02:55:26 2016 -0700 ovn-controller: if 'ovn-bridge-mappings' unconfigured, return directly. If the chassis doesn't configure the 'external-ids:ovn-bridge-mappings' in the OVSDB, the 'add_bridge_mappings' should return directly to skip some unnecessary code. Signed-off-by: nickcooper-zhangtonghao <nickcooper-zhangtong...@opencloud.tech> Signed-off-by: Russell Bryant <russ...@ovn.org> diff --git a/ovn/controller/patch.c b/ovn/controller/patch.c index 012e6ba..62d68d9 100644 --- a/ovn/controller/patch.c +++ b/ovn/controller/patch.c @@ -151,8 +151,8 @@ add_bridge_mappings(struct controller_ctx *ctx, cfg = ovsrec_open_vswitch_first(ctx->ovs_idl); if (cfg) { mappings_cfg = smap_get(&cfg->external_ids, "ovn-bridge-mappings"); - if (!mappings_cfg) { - mappings_cfg = ""; + if (!mappings_cfg || !mappings_cfg[0]) { + return; } } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev