bbaaef
From e7461df9caf912b2040bb8e330ba68f538001113 Mon Sep 17 00:00:00 2001
bbaaef
From: Russell Bryant <russell@ovn.org>
bbaaef
Date: Sat, 7 Dec 2019 23:09:38 -0500
bbaaef
Subject: [PATCH ovn 2/4] northd: Log all dynamic address assignments
bbaaef
bbaaef
This patch adds INFO level log messages for all dynamic address
bbaaef
assignments (MAC, IPv4, IPv6).  While debugging some issues in
bbaaef
ovn-kubernetes, I found it would be helpful to see ovn-northd's view
bbaaef
of what addresses were assigned where and when from its perspective.
bbaaef
bbaaef
Signed-off-by: Russell Bryant <russell@ovn.org>
bbaaef
Acked-by: Numan Siddique <numans@ovn.org>
bbaaef
bbaaef
(cherry picked from upstream commit 50fdc3e4cfc487eeb9b81c07d645cf46f4557309)
bbaaef
---
bbaaef
 ovn/northd/ovn-northd.c | 9 +++++++++
bbaaef
 1 file changed, 9 insertions(+)
bbaaef
bbaaef
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
bbaaef
index 55734b0..40835a0 100644
bbaaef
--- a/ovn/northd/ovn-northd.c
bbaaef
+++ b/ovn/northd/ovn-northd.c
bbaaef
@@ -1708,6 +1708,8 @@ update_dynamic_addresses(struct dynamic_address_update *update)
bbaaef
         break;
bbaaef
     case DYNAMIC:
bbaaef
         ip4 = htonl(ipam_get_unused_ip(update->od));
bbaaef
+        VLOG_INFO("Assigned dynamic IPv4 address '"IP_FMT"' to port '%s'",
bbaaef
+                  IP_ARGS(ip4), update->op->nbsp->name);
bbaaef
     }
bbaaef
 
bbaaef
     struct eth_addr mac;
bbaaef
@@ -1722,6 +1724,8 @@ update_dynamic_addresses(struct dynamic_address_update *update)
bbaaef
         break;
bbaaef
     case DYNAMIC:
bbaaef
         eth_addr_from_uint64(ipam_get_unused_mac(ip4), &mac);
bbaaef
+        VLOG_INFO("Assigned dynamic MAC address '"ETH_ADDR_FMT"' to port '%s'",
bbaaef
+                  ETH_ADDR_ARGS(mac), update->op->nbsp->name);
bbaaef
         break;
bbaaef
     }
bbaaef
 
bbaaef
@@ -1739,6 +1743,11 @@ update_dynamic_addresses(struct dynamic_address_update *update)
bbaaef
         break;
bbaaef
     case DYNAMIC:
bbaaef
         in6_generate_eui64(mac, &update->od->ipam_info.ipv6_prefix, &ip6;;
bbaaef
+        struct ds ip6_ds = DS_EMPTY_INITIALIZER;
bbaaef
+        ipv6_format_addr(&ip6, &ip6_ds);
bbaaef
+        VLOG_INFO("Assigned dynamic IPv6 address '%s' to port '%s'",
bbaaef
+                  ip6_ds.string, update->op->nbsp->name);
bbaaef
+        ds_destroy(&ip6_ds);
bbaaef
         break;
bbaaef
     }
bbaaef
 
bbaaef
-- 
bbaaef
1.8.3.1
bbaaef