Vendoring libnetwork 0.6.0-rc6

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2016-01-30 20:03:03 -08:00
Родитель 5f5a752bcf
Коммит f943fd7d24
7 изменённых файлов: 35 добавлений и 22 удалений

Просмотреть файл

@ -27,7 +27,7 @@ clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de
clone git github.com/imdario/mergo 0.2.1
#get libnetwork packages
clone git github.com/docker/libnetwork v0.6.0-rc5
clone git github.com/docker/libnetwork v0.6.0-rc6
clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4

Просмотреть файл

@ -1,5 +1,8 @@
# Changelog
## 0.6.0-rc6 (2016-01-30)
- Properly fixes https://github.com/docker/docker/issues/18814
## 0.6.0-rc5 (2016-01-26)
- Cleanup stale overlay sandboxes

Просмотреть файл

@ -49,33 +49,33 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
sbox := n.sandbox()
name1, name2, err := createVethPair()
overlayIfName, containerIfName, err := createVethPair()
if err != nil {
return err
}
ep.ifName = name2
ep.ifName = overlayIfName
// Set the container interface and its peer MTU to 1450 to allow
// for 50 bytes vxlan encap (inner eth header(14) + outer IP(20) +
// outer UDP(8) + vxlan header(8))
veth, err := netlink.LinkByName(name1)
veth, err := netlink.LinkByName(overlayIfName)
if err != nil {
return fmt.Errorf("cound not find link by name %s: %v", name1, err)
return fmt.Errorf("cound not find link by name %s: %v", overlayIfName, err)
}
err = netlink.LinkSetMTU(veth, vxlanVethMTU)
if err != nil {
return err
}
if err := sbox.AddInterface(name1, "veth",
if err := sbox.AddInterface(overlayIfName, "veth",
sbox.InterfaceOptions().Master(s.brName)); err != nil {
return fmt.Errorf("could not add veth pair inside the network sandbox: %v", err)
}
veth, err = netlink.LinkByName(name2)
veth, err = netlink.LinkByName(containerIfName)
if err != nil {
return fmt.Errorf("could not find link by name %s: %v", name2, err)
return fmt.Errorf("could not find link by name %s: %v", containerIfName, err)
}
err = netlink.LinkSetMTU(veth, vxlanVethMTU)
if err != nil {
@ -96,7 +96,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
}
if iNames := jinfo.InterfaceName(); iNames != nil {
err = iNames.SetNames(name2, "eth")
err = iNames.SetNames(containerIfName, "eth")
if err != nil {
return err
}
@ -136,14 +136,5 @@ func (d *driver) Leave(nid, eid string) error {
n.leaveSandbox()
link, err := netlink.LinkByName(ep.ifName)
if err != nil {
log.Warnf("Failed to retrieve interface link for interface removal on endpoint leave: %v", err)
return nil
}
if err := netlink.LinkDel(link); err != nil {
log.Warnf("Failed to delete interface link on endpoint leave: %v", err)
}
return nil
}

Просмотреть файл

@ -4,8 +4,10 @@ import (
"fmt"
"net"
log "github.com/Sirupsen/logrus"
"github.com/docker/libnetwork/driverapi"
"github.com/docker/libnetwork/netutils"
"github.com/vishvananda/netlink"
)
type endpointTable map[string]*endpoint
@ -97,6 +99,20 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
}
n.deleteEndpoint(eid)
if ep.ifName == "" {
return nil
}
link, err := netlink.LinkByName(ep.ifName)
if err != nil {
log.Debugf("Failed to retrieve interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
return nil
}
if err := netlink.LinkDel(link); err != nil {
log.Debugf("Failed to delete interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
}
return nil
}

Просмотреть файл

@ -160,7 +160,9 @@ func (n *network) destroySandbox() {
sbox := n.sandbox()
if sbox != nil {
for _, iface := range sbox.Info().Interfaces() {
iface.Remove()
if err := iface.Remove(); err != nil {
logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err)
}
}
for _, s := range n.subnets {

Просмотреть файл

@ -8,6 +8,7 @@ import (
"sync"
"syscall"
log "github.com/Sirupsen/logrus"
"github.com/docker/libnetwork/types"
"github.com/vishvananda/netlink"
)
@ -127,7 +128,7 @@ func (i *nwIface) Remove() error {
err = netlink.LinkSetName(iface, i.SrcName())
if err != nil {
fmt.Println("LinkSetName failed: ", err)
log.Debugf("LinkSetName failed for interface %s: %v", i.SrcName(), err)
return err
}
@ -139,7 +140,7 @@ func (i *nwIface) Remove() error {
} else if !isDefault {
// Move the network interface to caller namespace.
if err := netlink.LinkSetNsFd(iface, callerFD); err != nil {
fmt.Println("LinkSetNsPid failed: ", err)
log.Debugf("LinkSetNsPid failed for interface %s: %v", i.SrcName(), err)
return err
}
}

Просмотреть файл

@ -589,7 +589,7 @@ func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
// Only remove the interfaces owned by this endpoint from the sandbox.
if ep.hasInterface(i.SrcName()) {
if err := i.Remove(); err != nil {
log.Debugf("Remove interface failed: %v", err)
log.Debugf("Remove interface %s failed: %v", i.SrcName(), err)
}
}
}