Skip to content

Commit

Permalink
binding: Track local datapaths even when no transaction is possible.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Russell Bryant <[email protected]>
  • Loading branch information
blp committed Mar 7, 2016
1 parent 79b4e6d commit 0c0afad
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions ovn/controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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. */
Expand All @@ -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
Expand Down

0 comments on commit 0c0afad

Please sign in to comment.