networkd: Restart networkd twice to work around race

https://bugs.freedesktop.org/show_bug.cgi?id=76077
This commit is contained in:
Alex Crawford 2014-06-12 19:47:05 -05:00
parent fe388a3ab6
commit e3037f18a6

View File

@ -8,6 +8,7 @@ import (
"os/exec" "os/exec"
"path" "path"
"strings" "strings"
"time"
"github.com/coreos/coreos-cloudinit/network" "github.com/coreos/coreos-cloudinit/network"
"github.com/coreos/coreos-cloudinit/third_party/github.com/dotcloud/docker/pkg/netlink" "github.com/coreos/coreos-cloudinit/third_party/github.com/dotcloud/docker/pkg/netlink"
@ -19,6 +20,13 @@ const (
func RestartNetwork(interfaces []network.InterfaceGenerator) (err error) { func RestartNetwork(interfaces []network.InterfaceGenerator) (err error) {
defer func() { defer func() {
if e := restartNetworkd(); e != nil {
err = e
return
}
// TODO(crawford): Get rid of this once networkd fixes the race
// https://bugs.freedesktop.org/show_bug.cgi?id=76077
time.Sleep(5 * time.Second)
if e := restartNetworkd(); e != nil { if e := restartNetworkd(); e != nil {
err = e err = e
} }