From e3037f18a6e96454e3c6e1804a50a8492db77fa0 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Thu, 12 Jun 2014 19:47:05 -0500 Subject: [PATCH] networkd: Restart networkd twice to work around race https://bugs.freedesktop.org/show_bug.cgi?id=76077 --- system/networkd.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/networkd.go b/system/networkd.go index f9d59ce..9ef7e39 100644 --- a/system/networkd.go +++ b/system/networkd.go @@ -8,6 +8,7 @@ import ( "os/exec" "path" "strings" + "time" "github.com/coreos/coreos-cloudinit/network" "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) { 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 { err = e }