Add a few messages at INFO to help debug the vif lifecycle.
A logsearch on mac or ip helps debug what happened to the
vif and when. This helps easily correlate logs across CMS and ovn.

Logs appear like this:

2016-09-01T18:15:48Z|00014|binding|INFO|Claiming lport 
eee1a9af-7513-4540-9385-9e3972bfca05 for this chassis.
2016-09-01T18:15:48Z|00015|binding|INFO|Claiming fa:16:3e:01:c3:4a 10.0.0.7 
fd93:b509:aa46:0:f816:3eff:fe01:c34a
2016-09-01T18:15:59Z|00016|pinctrl|INFO|DHCPOFFER fa:16:3e:01:c3:4a 10.0.0.7
2016-09-01T18:15:59Z|00017|pinctrl|INFO|DHCPACK fa:16:3e:01:c3:4a 10.0.0.7
2016-09-01T18:16:22Z|00018|binding|INFO|Releasing lport 
eee1a9af-7513-4540-9385-9e3972bfca05 from this chassis.
2016-09-01T18:16:22Z|00019|binding|INFO|Releasing fa:16:3e:01:c3:4a 10.0.0.7 
fd93:b509:aa46:0:f816:3eff:fe01:c34a

Signed-off-by: Ramu Ramamurthy <ramu.ramamur...@us.ibm.com>
---
 v1->v2: add rate limit

 ovn/controller/binding.c | 6 ++++++
 ovn/controller/pinctrl.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index 0353a7b..13c51da 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -143,6 +143,9 @@ consider_local_datapath(struct controller_ctx *ctx,
             } 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("Claiming %s", binding_rec->mac[i]);
+                }
             }
             sbrec_port_binding_set_chassis(binding_rec, chassis_rec);
         }
@@ -179,6 +182,9 @@ consider_local_datapath(struct controller_ctx *ctx,
         if (ctx->ovnsb_idl_txn) {
             VLOG_INFO("Releasing lport %s from this chassis.",
                       binding_rec->logical_port);
+            for (int i = 0; i < binding_rec->n_mac; i++) {
+                VLOG_INFO("Releasing %s", binding_rec->mac[i]);
+            }
             sbrec_port_binding_set_chassis(binding_rec, NULL);
             sset_find_and_delete(all_lports, binding_rec->logical_port);
         }
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index d65e213..323faa1 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -354,6 +354,13 @@ pinctrl_handle_put_dhcp_opts(
     pin->packet = dp_packet_data(&pkt_out);
     pin->packet_len = dp_packet_size(&pkt_out);
 
+    /* Log the response. */
+    static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(20, 40);
+    const struct eth_header *l2 = dp_packet_l2(&pkt_out);
+    VLOG_INFO_RL(&rl, "DHCP%s "ETH_ADDR_FMT" "IP_FMT"",
+                 msg_type == DHCP_MSG_OFFER ? "OFFER" : "ACK",
+                 ETH_ADDR_ARGS(l2->eth_src), IP_ARGS(*offer_ip));
+
     success = 1;
 exit:
     if (!ofperr) {
-- 
1.8.3.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to