From e246b8a9f6837ae6466c5822ede2e92b157e2d6a Mon Sep 17 00:00:00 2001
From: Jan Chaloupka <jchaloup@redhat.com>
Date: Sun, 8 Mar 2015 21:15:43 +0100
Subject: [PATCH] flannel-vxlan-create-retry.patch
Original author is John W. Linville. I have updated the patch to fit for rhel.
---
backend/vxlan/vxlan.go | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/backend/vxlan/vxlan.go b/backend/vxlan/vxlan.go
index 93977b4..d50f520 100644
--- a/backend/vxlan/vxlan.go
+++ b/backend/vxlan/vxlan.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"sync"
+ "time"
log "github.com/coreos/flannel/Godeps/_workspace/src/github.com/golang/glog"
"github.com/coreos/flannel/Godeps/_workspace/src/github.com/vishvananda/netlink"
@@ -73,9 +74,16 @@ func (vb *VXLANBackend) Init(extIface *net.Interface, extIP net.IP, ipMasq bool)
}
var err error
- vb.dev, err = newVXLANDevice(&devAttrs)
- if err != nil {
- return nil, err
+ for {
+ vb.dev, err = newVXLANDevice(&devAttrs)
+ if err == nil {
+ break
+ } else {
+ log.Warning("Failed to create VXLAN interface, retrying...")
+
+ // wait 1 sec before retrying
+ time.Sleep(1*time.Second)
+ }
}
sa, err := newSubnetAttrs(extIP, vb.dev.MACAddr())
--
1.9.3