From: Ben Pfaff Date: Mon, 7 Mar 2016 20:53:15 +0000 (-0800) Subject: binding: Track local datapaths even when no transaction is possible. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=0c0afad722d9758b6c50b91300d807a8f6d390d8 binding: Track local datapaths even when no transaction is possible. Plenty of other code depends on the set of local datapaths. Most notably, the lflow code will drop logical flows when their logical datapaths aren't present locally. Signed-off-by: Ben Pfaff Acked-by: Russell Bryant --- diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c index 9087052cc..d3ca9c984 100644 --- a/ovn/controller/binding.c +++ b/ovn/controller/binding.c @@ -154,10 +154,6 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, const struct sbrec_chassis *chassis_rec; const struct sbrec_port_binding *binding_rec; - if (!ctx->ovnsb_idl_txn) { - return; - } - chassis_rec = get_chassis(ctx->ovnsb_idl, chassis_id); if (!chassis_rec) { return; @@ -177,10 +173,6 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, sset_add(&all_lports, node->name); } - ovsdb_idl_txn_add_comment( - ctx->ovnsb_idl_txn,"ovn-controller: updating port bindings for '%s'", - chassis_id); - /* Run through each binding record to see if it is resident on this * chassis and update the binding accordingly. This includes both * directly connected logical ports and children of those ports. */ @@ -201,15 +193,24 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int, if (binding_rec->chassis == chassis_rec) { continue; } - if (binding_rec->chassis) { - VLOG_INFO("Changing chassis for lport %s from %s to %s", - binding_rec->logical_port, - binding_rec->chassis->name, - chassis_rec->name); + if (ctx->ovnsb_idl_txn) { + if (binding_rec->chassis) { + VLOG_INFO("Changing chassis for lport %s from %s to %s.", + binding_rec->logical_port, + binding_rec->chassis->name, + chassis_rec->name); + } else { + VLOG_INFO("Claiming lport %s for this chassis.", + binding_rec->logical_port); + } + sbrec_port_binding_set_chassis(binding_rec, chassis_rec); } - sbrec_port_binding_set_chassis(binding_rec, chassis_rec); } else if (binding_rec->chassis == chassis_rec) { - sbrec_port_binding_set_chassis(binding_rec, NULL); + if (ctx->ovnsb_idl_txn) { + VLOG_INFO("Releasing lport %s from this chassis.", + binding_rec->logical_port); + sbrec_port_binding_set_chassis(binding_rec, NULL); + } } else if (!binding_rec->chassis && !strcmp(binding_rec->type, "localnet")) { /* localnet ports will never be bound to a chassis, but we want