Browse Source

Cleanup servicebindings only on Windows

Make the call to cleanupServiceBindings during network deletion
conditional on Windows (where it is required), thereby providing a
performance improvement to network cleanup on Linux.

Signed-off-by: Trapier Marshall <tmarshall@mirantis.com>
Trapier Marshall 4 years ago
parent
commit
a46700dbdb
1 changed files with 4 additions and 1 deletions
  1. 4 1
      libnetwork/network.go

+ 4 - 1
libnetwork/network.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"net"
+	"runtime"
 	"strings"
 	"sync"
 	"time"
@@ -1081,7 +1082,9 @@ func (n *network) delete(force bool, rmLBEndpoint bool) error {
 	// Cleanup the load balancer. On Windows this call is required
 	// to remove remote loadbalancers in VFP, and must be performed before
 	// dataplane network deletion.
-	c.cleanupServiceBindings(n.ID())
+	if runtime.GOOS == "windows" {
+		c.cleanupServiceBindings(n.ID())
+	}
 
 	// Delete the network from the dataplane
 	if err = n.deleteNetwork(); err != nil {