Browse code

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 authored on 2021/02/04 17:31:33
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"encoding/json"
5 5
 	"fmt"
6 6
 	"net"
7
+	"runtime"
7 8
 	"strings"
8 9
 	"sync"
9 10
 	"time"
... ...
@@ -1081,7 +1082,9 @@ func (n *network) delete(force bool, rmLBEndpoint bool) error {
1081 1081
 	// Cleanup the load balancer. On Windows this call is required
1082 1082
 	// to remove remote loadbalancers in VFP, and must be performed before
1083 1083
 	// dataplane network deletion.
1084
-	c.cleanupServiceBindings(n.ID())
1084
+	if runtime.GOOS == "windows" {
1085
+		c.cleanupServiceBindings(n.ID())
1086
+	}
1085 1087
 
1086 1088
 	// Delete the network from the dataplane
1087 1089
 	if err = n.deleteNetwork(); err != nil {