Blob Blame History Raw
From e7461df9caf912b2040bb8e330ba68f538001113 Mon Sep 17 00:00:00 2001
From: Russell Bryant <russell@ovn.org>
Date: Sat, 7 Dec 2019 23:09:38 -0500
Subject: [PATCH ovn 2/4] northd: Log all dynamic address assignments

This patch adds INFO level log messages for all dynamic address
assignments (MAC, IPv4, IPv6).  While debugging some issues in
ovn-kubernetes, I found it would be helpful to see ovn-northd's view
of what addresses were assigned where and when from its perspective.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Numan Siddique <numans@ovn.org>

(cherry picked from upstream commit 50fdc3e4cfc487eeb9b81c07d645cf46f4557309)
---
 ovn/northd/ovn-northd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 55734b0..40835a0 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1708,6 +1708,8 @@ update_dynamic_addresses(struct dynamic_address_update *update)
         break;
     case DYNAMIC:
         ip4 = htonl(ipam_get_unused_ip(update->od));
+        VLOG_INFO("Assigned dynamic IPv4 address '"IP_FMT"' to port '%s'",
+                  IP_ARGS(ip4), update->op->nbsp->name);
     }
 
     struct eth_addr mac;
@@ -1722,6 +1724,8 @@ update_dynamic_addresses(struct dynamic_address_update *update)
         break;
     case DYNAMIC:
         eth_addr_from_uint64(ipam_get_unused_mac(ip4), &mac);
+        VLOG_INFO("Assigned dynamic MAC address '"ETH_ADDR_FMT"' to port '%s'",
+                  ETH_ADDR_ARGS(mac), update->op->nbsp->name);
         break;
     }
 
@@ -1739,6 +1743,11 @@ update_dynamic_addresses(struct dynamic_address_update *update)
         break;
     case DYNAMIC:
         in6_generate_eui64(mac, &update->od->ipam_info.ipv6_prefix, &ip6);
+        struct ds ip6_ds = DS_EMPTY_INITIALIZER;
+        ipv6_format_addr(&ip6, &ip6_ds);
+        VLOG_INFO("Assigned dynamic IPv6 address '%s' to port '%s'",
+                  ip6_ds.string, update->op->nbsp->name);
+        ds_destroy(&ip6_ds);
         break;
     }
 
-- 
1.8.3.1