From 181115b350c3ea4accef7f2461c42810c953ca79 Mon Sep 17 00:00:00 2001 From: Flavio Crisciani Date: Wed, 20 Sep 2017 08:37:18 -0700 Subject: [PATCH] Addressing code review comments Signed-off-by: Flavio Crisciani --- libnetwork/drivers/overlay/joinleave.go | 1 - libnetwork/drivers/overlay/ov_network.go | 14 ++++++-------- libnetwork/osl/neigh_linux.go | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libnetwork/drivers/overlay/joinleave.go b/libnetwork/drivers/overlay/joinleave.go index b97cc88f05..0770513e7d 100644 --- a/libnetwork/drivers/overlay/joinleave.go +++ b/libnetwork/drivers/overlay/joinleave.go @@ -224,7 +224,6 @@ func (d *driver) Leave(nid, eid string) error { return types.InternalMaskableErrorf("could not find endpoint with id %s", eid) } - logrus.Errorf("The channel is valid:%t", d.notifyCh != nil) if d.notifyCh != nil { d.notifyCh <- ovNotify{ action: "leave", diff --git a/libnetwork/drivers/overlay/ov_network.go b/libnetwork/drivers/overlay/ov_network.go index d8700e92c3..55bb49b30f 100644 --- a/libnetwork/drivers/overlay/ov_network.go +++ b/libnetwork/drivers/overlay/ov_network.go @@ -769,7 +769,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket) { continue } n.driver.peerAdd(n.id, "dummy", ip, IPmask, mac, vtep, l2Miss, l3Miss, false) - } else { + } else if l3Miss && time.Since(t) > 500*time.Millisecond { // All the local peers will trigger a miss notification but this one is expected and the local container will reply // autonomously to the ARP request // In case the gc_thresh3 values is low kernel might reject new entries during peerAdd. This will trigger the following @@ -778,13 +778,11 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket) { // Entries which are marked as permanent are never deleted by the garbage-collector. // The time limit here is to guarantee that the dbSearch is not // done too frequently causing a stall of the peerDB operations. - if l3Miss && time.Since(t) > 500*time.Millisecond { - t = time.Now() - pKey, pEntry, err := n.driver.peerDbSearch(n.id, ip) - if !pEntry.isLocal { - logrus.Warnf("miss notification for peer:%+v l3Miss:%t l2Miss:%t, if the problem persist check the gc_thresh on the host pKey:%+v pEntry:%+v err:%v", - neigh, l3Miss, l2Miss, *pKey, *pEntry, err) - } + t = time.Now() + pKey, pEntry, err := n.driver.peerDbSearch(n.id, ip) + if !pEntry.isLocal { + logrus.Warnf("miss notification for peer:%+v l3Miss:%t l2Miss:%t, if the problem persist check the gc_thresh on the host pKey:%+v pEntry:%+v err:%v", + neigh, l3Miss, l2Miss, *pKey, *pEntry, err) } } } diff --git a/libnetwork/osl/neigh_linux.go b/libnetwork/osl/neigh_linux.go index ae854fc1b7..6bf1c16dc5 100644 --- a/libnetwork/osl/neigh_linux.go +++ b/libnetwork/osl/neigh_linux.go @@ -188,7 +188,7 @@ func (n *networkNamespace) AddNeighbor(dstIP net.IP, dstMac net.HardwareAddr, fo n.Lock() n.neighbors = append(n.neighbors, nh) n.Unlock() - logrus.Debugf("Neighbor entry added for IP %v, mac %v on ifc:%s", dstIP, dstMac, nh.linkName) + logrus.Debugf("Neighbor entry added for IP:%v, mac:%v on ifc:%s", dstIP, dstMac, nh.linkName) return nil }