From c27417aa7de46daa415600b39fc8a9c411c8c493 Mon Sep 17 00:00:00 2001 From: Chris Telfer Date: Tue, 20 Mar 2018 13:23:32 -0400 Subject: [PATCH] Remove (now) extra call to sb.DisableService() This call was added as part of commit a042e5a20 and at the time was useful. sandbox.DisableService() basically calls endpoint.deleteServiceInfoFromCluster() for every endpoint in the sandbox. However, with the libnetwork change, endpoint.sbLeave() invokes endpoint.deleteServiceInfoFromCluster(). The releaseNetwork() call invokes sandbox.Delete() immediately after sandbox.DisableService(). The sandbox.Delete() in turn ultimately invokes endpoint.sbLeave() for every endpoint in the sandbox which thus removes the endpoint's load balancing entry via endpoint.deleteServiceInfoFromCluster(). So the call to sandbox.DisableService() is now redundant. It is noteworthy that, while redundant, the presence of the call would not cause errors. It would just be sub-optimal. The DisableService() call would cause libnetwork to down-weight the load balancing entries while the call to sandbox.Delete() would cause it to remove the entries immediately afterwards. Aside from the wasted computation, the extra call would also propagate an extra state change in the networkDB gossip messages. So, overall, it is much better to just avoid the extra overhead. Signed-off-by: Chris Telfer --- daemon/container_operations.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/daemon/container_operations.go b/daemon/container_operations.go index 9b67b4546d..36790e02bf 100644 --- a/daemon/container_operations.go +++ b/daemon/container_operations.go @@ -979,9 +979,6 @@ func (daemon *Daemon) releaseNetwork(container *container.Container) { logrus.Warnf("error locating sandbox id %s: %v", sid, err) return } - if err := sb.DisableService(); err != nil { - logrus.WithFields(logrus.Fields{"container": container.ID, "sandbox": sid}).WithError(err).Error("Error removing service from sandbox") - } if err := sb.Delete(); err != nil { logrus.Errorf("Error deleting sandbox id %s for container %s: %v", sid, container.ID, err)