瀏覽代碼

Merge pull request #2524 from trapier/cleanup-vfp-during-network-removal

Cleanup VFP during overlay network removal
elangovan sivanandam 5 年之前
父節點
當前提交
a9596db128
共有 2 個文件被更改,包括 9 次插入3 次删除
  1. 4 0
      libnetwork/network.go
  2. 5 3
      libnetwork/service_common.go

+ 4 - 0
libnetwork/network.go

@@ -1088,6 +1088,10 @@ func (n *network) delete(force bool, rmLBEndpoint bool) error {
 	// Cleanup the service discovery for this network
 	c.cleanupServiceDiscovery(n.ID())
 
+	// Cleanup the load balancer. On Windows this call is required
+	// to remove remote loadbalancers in VFP.
+	c.cleanupServiceBindings(n.ID())
+
 removeFromStore:
 	// deleteFromStore performs an atomic delete operation and the
 	// network.epCnt will help prevent any possible

+ 5 - 3
libnetwork/service_common.go

@@ -369,9 +369,11 @@ func (c *controller) rmServiceBinding(svcName, svcID, nID, eID, containerName st
 	// sandboxes in the network only if the vip is valid.
 	if entries == 0 {
 		// The network may well have been deleted before the last
-		// of the service bindings.  That's ok, because removing
-		// the network sandbox implicitly removes the backend
-		// service bindings.
+		// of the service bindings.  That's ok on Linux because
+		// removing the network sandbox implicitly removes the
+		// backend service bindings.  Windows VFP cleanup requires
+		// calling cleanupServiceBindings on the network prior to
+		// deleting the network, performed by network.delete.
 		n, err := c.NetworkByID(nID)
 		if err == nil {
 			n.(*network).rmLBBackend(ip, lb, rmService, fullRemove)