Browse code

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 <ctelfer@docker.com>

Chris Telfer authored on 2018/03/21 02:23:32
Showing 1 changed files
... ...
@@ -979,9 +979,6 @@ func (daemon *Daemon) releaseNetwork(container *container.Container) {
979 979
 		logrus.Warnf("error locating sandbox id %s: %v", sid, err)
980 980
 		return
981 981
 	}
982
-	if err := sb.DisableService(); err != nil {
983
-		logrus.WithFields(logrus.Fields{"container": container.ID, "sandbox": sid}).WithError(err).Error("Error removing service from sandbox")
984
-	}
985 982
 
986 983
 	if err := sb.Delete(); err != nil {
987 984
 		logrus.Errorf("Error deleting sandbox id %s for container %s: %v", sid, container.ID, err)