Blame SOURCES/flannel-vxlan-create-retry.patch

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