diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d13bd0ef09..65dbfae695 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1089,8 +1089,7 @@ }, { "ImportPath": "github.com/docker/libnetwork/ipvs", - "Comment": "v0.8.0-dev.2-908-gd5c82231", - "Rev": "d5c822319097cc01cc9bd5ffedd74c7ce7c894f2" + "Rev": "ba46b928444931e6865d8618dc03622cac79aa6f" }, { "ImportPath": "github.com/docker/libtrust", diff --git a/pkg/util/ipvs/ipvs_linux.go b/pkg/util/ipvs/ipvs_linux.go index be50ad515c..4dc732588e 100644 --- a/pkg/util/ipvs/ipvs_linux.go +++ b/pkg/util/ipvs/ipvs_linux.go @@ -142,18 +142,7 @@ func (runner *runner) GetVirtualServers() ([]*VirtualServer, error) { // Flush is part of Interface. Currently we delete IPVS services one by one func (runner *runner) Flush() error { - vss, err := runner.GetVirtualServers() - if err != nil { - return err - } - for _, vs := range vss { - err := runner.DeleteVirtualServer(vs) - // TODO: aggregate errors? - if err != nil { - return err - } - } - return nil + return runner.ipvsHandle.Flush() } // AddRealServer is part of Interface. diff --git a/vendor/github.com/docker/libnetwork/ipvs/ipvs.go b/vendor/github.com/docker/libnetwork/ipvs/ipvs.go index a285e102e3..ebcdd808c3 100644 --- a/vendor/github.com/docker/libnetwork/ipvs/ipvs.go +++ b/vendor/github.com/docker/libnetwork/ipvs/ipvs.go @@ -116,6 +116,13 @@ func (i *Handle) DelService(s *Service) error { return i.doCmd(s, nil, ipvsCmdDelService) } +// Flush deletes all existing services in the passed +// handle. +func (i *Handle) Flush() error { + _, err := i.doCmdWithoutAttr(ipvsCmdFlush) + return err +} + // NewDestination creates a new real server in the passed ipvs // service which should already be existing in the passed handle. func (i *Handle) NewDestination(s *Service, d *Destination) error { diff --git a/vendor/github.com/docker/libnetwork/ipvs/netlink.go b/vendor/github.com/docker/libnetwork/ipvs/netlink.go index b8d33dcdc4..2089283d14 100644 --- a/vendor/github.com/docker/libnetwork/ipvs/netlink.go +++ b/vendor/github.com/docker/libnetwork/ipvs/netlink.go @@ -402,6 +402,13 @@ func (i *Handle) doGetServicesCmd(svc *Service) ([]*Service, error) { return res, nil } +// doCmdWithoutAttr a simple wrapper of netlink socket execute command +func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) { + req := newIPVSRequest(cmd) + req.Seq = atomic.AddUint32(&i.seq, 1) + return execute(i.sock, req, 0) +} + func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error) { var d Destination