Blame SOURCES/0388-ifup-setup-bridge-bonding-and-teaming-only-once.patch

a0a3b4
From 1472b5486b8f64a023ea33f9c1821279b153d04a Mon Sep 17 00:00:00 2001
a0a3b4
From: Harald Hoyer <harald@redhat.com>
a0a3b4
Date: Fri, 10 Jun 2016 14:34:13 +0200
a0a3b4
Subject: [PATCH] ifup: setup bridge, bonding and teaming only once
a0a3b4
a0a3b4
if those assembled interfaces use dhcp "$iface.up" is created too late
a0a3b4
---
a0a3b4
 modules.d/40network/ifup.sh | 14 ++++++++++----
a0a3b4
 1 file changed, 10 insertions(+), 4 deletions(-)
a0a3b4
a0a3b4
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
1755ca
index 30551987..f681336e 100755
a0a3b4
--- a/modules.d/40network/ifup.sh
a0a3b4
+++ b/modules.d/40network/ifup.sh
a0a3b4
@@ -204,9 +204,12 @@ fi
a0a3b4
 if [ -e /tmp/bond.${netif}.info ]; then
a0a3b4
     . /tmp/bond.${netif}.info
a0a3b4
 
a0a3b4
-    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
a0a3b4
+    if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.setup ] ; then # We are master bond device
a0a3b4
         modprobe bonding
a0a3b4
-        echo "+$netif" >  /sys/class/net/bonding_masters
a0a3b4
+        udevadm settle
a0a3b4
+        if ! [ -e /sys/class/net/${netif} ]; then
a0a3b4
+            echo "+$netif" >  /sys/class/net/bonding_masters
a0a3b4
+        fi
a0a3b4
         ip link set $netif down
a0a3b4
 
a0a3b4
         # Stolen from ifup-eth
a0a3b4
@@ -244,12 +247,13 @@ if [ -e /tmp/bond.${netif}.info ]; then
a0a3b4
                 echo $value > /sys/class/net/${netif}/bonding/$key
a0a3b4
             fi
a0a3b4
         done
a0a3b4
+        > /tmp/net.$bondname.setup
a0a3b4
     fi
a0a3b4
 fi
a0a3b4
 
a0a3b4
 if [ -e /tmp/team.${netif}.info ]; then
a0a3b4
     . /tmp/team.${netif}.info
a0a3b4
-    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then
a0a3b4
+    if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.setup ] ; then
a0a3b4
         # We shall only bring up those _can_ come up
a0a3b4
         # in case of some slave is gone in active-backup mode
a0a3b4
         working_slaves=""
a0a3b4
@@ -285,6 +289,7 @@ if [ -e /tmp/team.${netif}.info ]; then
a0a3b4
             teamdctl $teammaster port add $slave
a0a3b4
         done
a0a3b4
         ip link set dev $teammaster up
a0a3b4
+        > /tmp/net.$teammaster.setup
a0a3b4
     fi
a0a3b4
 fi
a0a3b4
 
a0a3b4
@@ -293,7 +298,7 @@ fi
a0a3b4
 if [ -e /tmp/bridge.info ]; then
a0a3b4
     . /tmp/bridge.info
a0a3b4
 # start bridge if necessary
a0a3b4
-    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
a0a3b4
+    if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.setup ]; then
a0a3b4
         brctl addbr $bridgename
a0a3b4
         brctl setfd $bridgename 0
a0a3b4
         for ethname in $bridgeslaves ; do
a0a3b4
@@ -308,6 +313,7 @@ if [ -e /tmp/bridge.info ]; then
a0a3b4
             fi
a0a3b4
             brctl addif $bridgename $ethname
a0a3b4
         done
a0a3b4
+        > /tmp/net.$bridgename.setup
a0a3b4
     fi
a0a3b4
 fi
a0a3b4