make sure interface up successful
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
This commit is contained in:
parent
090a12035f
commit
93cada0d94
|
@ -6,6 +6,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/docker/libnetwork/ns"
|
"github.com/docker/libnetwork/ns"
|
||||||
|
@ -290,7 +291,12 @@ func (n *networkNamespace) AddInterface(srcName, dstPrefix string, options ...If
|
||||||
}
|
}
|
||||||
|
|
||||||
// Up the interface.
|
// 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)
|
return fmt.Errorf("failed to set link up: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue