diff --git a/libnetwork/drivers/windows/overlay/ov_endpoint_windows.go b/libnetwork/drivers/windows/overlay/ov_endpoint_windows.go index cc5679fd25..94b4a2eae3 100644 --- a/libnetwork/drivers/windows/overlay/ov_endpoint_windows.go +++ b/libnetwork/drivers/windows/overlay/ov_endpoint_windows.go @@ -7,7 +7,7 @@ import ( "sync" "github.com/Microsoft/hcsshim" - "github.com/docker/docker/pkg/system" + "github.com/Microsoft/hcsshim/osversion" "github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/drivers/windows" "github.com/docker/libnetwork/netlabel" @@ -34,7 +34,7 @@ var ( //Server 2016 (RS1) does not support concurrent add/delete of endpoints. Therefore, we need //to use this mutex and serialize the add/delete of endpoints on RS1. endpointMu sync.Mutex - windowsBuild = system.GetOSVersion().Build + windowsBuild = osversion.Build() ) func validateID(nid, eid string) error { @@ -155,7 +155,7 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo, hnsEndpoint.Policies = append(hnsEndpoint.Policies, paPolicy) - if system.GetOSVersion().Build > 16236 { + if osversion.Build() > 16236 { natPolicy, err := json.Marshal(hcsshim.PaPolicy{ Type: "OutBoundNAT", }) diff --git a/libnetwork/drivers/windows/windows.go b/libnetwork/drivers/windows/windows.go index f739a8cc20..2dbd7c949e 100644 --- a/libnetwork/drivers/windows/windows.go +++ b/libnetwork/drivers/windows/windows.go @@ -20,7 +20,7 @@ import ( "sync" "github.com/Microsoft/hcsshim" - "github.com/docker/docker/pkg/system" + "github.com/Microsoft/hcsshim/osversion" "github.com/docker/libnetwork/datastore" "github.com/docker/libnetwork/discoverapi" "github.com/docker/libnetwork/driverapi" @@ -217,7 +217,7 @@ func (d *driver) parseNetworkOptions(id string, genericOptions map[string]string } config.VSID = uint(vsid) case EnableOutboundNat: - if system.GetOSVersion().Build <= 16236 { + if osversion.Build() <= 16236 { return nil, fmt.Errorf("Invalid network option. OutboundNat is not supported on this OS version") } b, err := strconv.ParseBool(value) diff --git a/libnetwork/firewall_test.go b/libnetwork/firewall_test.go index 65a12f5a48..9ef64cb6d7 100644 --- a/libnetwork/firewall_test.go +++ b/libnetwork/firewall_test.go @@ -2,13 +2,13 @@ package libnetwork import ( "fmt" - "gotest.tools/assert" "strings" "testing" "github.com/docker/libnetwork/iptables" "github.com/docker/libnetwork/netlabel" "github.com/docker/libnetwork/options" + "gotest.tools/assert" ) const ( diff --git a/libnetwork/service_windows.go b/libnetwork/service_windows.go index 944f3d30ca..7f8eb5366a 100644 --- a/libnetwork/service_windows.go +++ b/libnetwork/service_windows.go @@ -4,7 +4,7 @@ import ( "net" "github.com/Microsoft/hcsshim" - "github.com/docker/docker/pkg/system" + "github.com/Microsoft/hcsshim/osversion" "github.com/sirupsen/logrus" ) @@ -27,7 +27,7 @@ func (n *network) addLBBackend(ip net.IP, lb *loadBalancer) { vip := lb.vip ingressPorts := lb.service.ingressPorts - if system.GetOSVersion().Build > 16236 { + if osversion.Build() > 16236 { lb.Lock() defer lb.Unlock() //find the load balancer IP for the network. @@ -128,7 +128,7 @@ func (n *network) rmLBBackend(ip net.IP, lb *loadBalancer, rmService bool, fullR return } - if system.GetOSVersion().Build > 16236 { + if osversion.Build() > 16236 { if numEnabledBackends(lb) > 0 { //Reprogram HNS (actually VFP) with the existing backends. n.addLBBackend(ip, lb)