1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Replace use of deprecated functions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-08-31 20:18:32 +02:00
parent 304bb14ffc
commit bf28003c99
4 changed files with 9 additions and 9 deletions

View file

@ -7,7 +7,7 @@ import (
"sync" "sync"
"github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim"
"github.com/docker/docker/pkg/system" "github.com/Microsoft/hcsshim/osversion"
"github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/driverapi"
"github.com/docker/libnetwork/drivers/windows" "github.com/docker/libnetwork/drivers/windows"
"github.com/docker/libnetwork/netlabel" "github.com/docker/libnetwork/netlabel"
@ -34,7 +34,7 @@ var (
//Server 2016 (RS1) does not support concurrent add/delete of endpoints. Therefore, we need //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. //to use this mutex and serialize the add/delete of endpoints on RS1.
endpointMu sync.Mutex endpointMu sync.Mutex
windowsBuild = system.GetOSVersion().Build windowsBuild = osversion.Build()
) )
func validateID(nid, eid string) error { 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) hnsEndpoint.Policies = append(hnsEndpoint.Policies, paPolicy)
if system.GetOSVersion().Build > 16236 { if osversion.Build() > 16236 {
natPolicy, err := json.Marshal(hcsshim.PaPolicy{ natPolicy, err := json.Marshal(hcsshim.PaPolicy{
Type: "OutBoundNAT", Type: "OutBoundNAT",
}) })

View file

@ -20,7 +20,7 @@ import (
"sync" "sync"
"github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim"
"github.com/docker/docker/pkg/system" "github.com/Microsoft/hcsshim/osversion"
"github.com/docker/libnetwork/datastore" "github.com/docker/libnetwork/datastore"
"github.com/docker/libnetwork/discoverapi" "github.com/docker/libnetwork/discoverapi"
"github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/driverapi"
@ -217,7 +217,7 @@ func (d *driver) parseNetworkOptions(id string, genericOptions map[string]string
} }
config.VSID = uint(vsid) config.VSID = uint(vsid)
case EnableOutboundNat: 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") return nil, fmt.Errorf("Invalid network option. OutboundNat is not supported on this OS version")
} }
b, err := strconv.ParseBool(value) b, err := strconv.ParseBool(value)

View file

@ -2,13 +2,13 @@ package libnetwork
import ( import (
"fmt" "fmt"
"gotest.tools/assert"
"strings" "strings"
"testing" "testing"
"github.com/docker/libnetwork/iptables" "github.com/docker/libnetwork/iptables"
"github.com/docker/libnetwork/netlabel" "github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options" "github.com/docker/libnetwork/options"
"gotest.tools/assert"
) )
const ( const (

View file

@ -4,7 +4,7 @@ import (
"net" "net"
"github.com/Microsoft/hcsshim" "github.com/Microsoft/hcsshim"
"github.com/docker/docker/pkg/system" "github.com/Microsoft/hcsshim/osversion"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -27,7 +27,7 @@ func (n *network) addLBBackend(ip net.IP, lb *loadBalancer) {
vip := lb.vip vip := lb.vip
ingressPorts := lb.service.ingressPorts ingressPorts := lb.service.ingressPorts
if system.GetOSVersion().Build > 16236 { if osversion.Build() > 16236 {
lb.Lock() lb.Lock()
defer lb.Unlock() defer lb.Unlock()
//find the load balancer IP for the network. //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 return
} }
if system.GetOSVersion().Build > 16236 { if osversion.Build() > 16236 {
if numEnabledBackends(lb) > 0 { if numEnabledBackends(lb) > 0 {
//Reprogram HNS (actually VFP) with the existing backends. //Reprogram HNS (actually VFP) with the existing backends.
n.addLBBackend(ip, lb) n.addLBBackend(ip, lb)