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

Merge pull request #1279 from BSWANG/master

make sure interface up successful
This commit is contained in:
Alessandro Boch 2016-06-22 08:17:28 -07:00 committed by GitHub
commit 382aefbeb5

View file

@ -6,6 +6,7 @@ import (
"regexp"
"sync"
"syscall"
"time"
log "github.com/Sirupsen/logrus"
"github.com/docker/libnetwork/ns"
@ -290,7 +291,12 @@ func (n *networkNamespace) AddInterface(srcName, dstPrefix string, options ...If
}
// Up the interface.
if err := nlh.LinkSetUp(iface); err != nil {
cnt := 0
for err = nlh.LinkSetUp(iface); err != nil && cnt < 3; cnt++ {
log.Debugf("retrying link setup because of: %v", err)
time.Sleep(10 * time.Millisecond)
}
if err != nil {
return fmt.Errorf("failed to set link up: %v", err)
}