Message ID | 1482269026-29197-1-git-send-email-mickeys.dev@gmail.com |
---|---|
State | Accepted |
Headers | show |
On Tue, Dec 20, 2016 at 01:23:46PM -0800, Mickey Spiegel wrote: > With recent OVN commits, the logic for a chassis to claim > or release a logical port was consolidated. This is a > good thing. However, there was a logic change that > resulted in VLOG_INFO being generated every time on the > ovn-controller. This patch changes the logic so that > VLOG_INFO is only generated when there is a change, for > example when the chassis claims an lport the first time. > > Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com> Thanks a lot, I applied this. I don't think the first clause of the "if" here is necessary, so I removed it: > + if (!binding_rec->chassis > + || (binding_rec->chassis != chassis_rec)) { > + 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); > + } > + for (int i = 0; i < binding_rec->n_mac; i++) { > + VLOG_INFO("%s: Claiming %s", > + binding_rec->logical_port, binding_rec->mac[i]); > + } > + sbrec_port_binding_set_chassis(binding_rec, chassis_rec); > } > - sbrec_port_binding_set_chassis(binding_rec, chassis_rec);
diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c index feca433..3a0dcc4 100644 --- a/ovn/controller/binding.c +++ b/ovn/controller/binding.c @@ -372,17 +372,23 @@ consider_local_datapath(struct controller_ctx *ctx, if (ctx->ovnsb_idl_txn) { if (our_chassis) { - 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); - } - for (int i = 0; i < binding_rec->n_mac; i++) { - VLOG_INFO("%s: Claiming %s", - binding_rec->logical_port, binding_rec->mac[i]); + if (!binding_rec->chassis + || (binding_rec->chassis != chassis_rec)) { + 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); + } + for (int i = 0; i < binding_rec->n_mac; i++) { + VLOG_INFO("%s: Claiming %s", + binding_rec->logical_port, binding_rec->mac[i]); + } + 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) { VLOG_INFO("Releasing lport %s from this chassis.", binding_rec->logical_port);
With recent OVN commits, the logic for a chassis to claim or release a logical port was consolidated. This is a good thing. However, there was a logic change that resulted in VLOG_INFO being generated every time on the ovn-controller. This patch changes the logic so that VLOG_INFO is only generated when there is a change, for example when the chassis claims an lport the first time. Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com> --- ovn/controller/binding.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)