Blame SOURCES/0389-network-parse-bond.sh-handle-multiple-bond-interface.patch

a0a3b4
From fefb96f43fd6b6b76e79fda995b31e2c10884395 Mon Sep 17 00:00:00 2001
a0a3b4
From: Harald Hoyer <harald@redhat.com>
a0a3b4
Date: Wed, 22 Jun 2016 13:21:56 +0200
a0a3b4
Subject: [PATCH] network/parse-bond.sh: handle multiple bond interfaces
a0a3b4
a0a3b4
---
a0a3b4
 modules.d/40network/parse-bond.sh | 25 +++++++------------------
a0a3b4
 1 file changed, 7 insertions(+), 18 deletions(-)
a0a3b4
a0a3b4
diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh
1755ca
index 25c51b89..80b3b077 100755
a0a3b4
--- a/modules.d/40network/parse-bond.sh
a0a3b4
+++ b/modules.d/40network/parse-bond.sh
a0a3b4
@@ -10,14 +10,6 @@
a0a3b4
 #       bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
a0a3b4
 #
a0a3b4
 
a0a3b4
-# return if bond already parsed
a0a3b4
-[ -n "$bondname" ] && return
a0a3b4
-
a0a3b4
-# Check if bond parameter is valid
a0a3b4
-if getarg bond= >/dev/null ; then
a0a3b4
-    :
a0a3b4
-fi
a0a3b4
-
a0a3b4
 # We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
a0a3b4
 # Ditto for bonding options
a0a3b4
 parsebond() {
a0a3b4
@@ -28,7 +20,6 @@ parsebond() {
a0a3b4
         v=${v#*:}
a0a3b4
     done
a0a3b4
 
a0a3b4
-    unset bondname bondslaves bondoptions
a0a3b4
     case $# in
a0a3b4
     0)  bondname=bond0; bondslaves="eth0 eth1" ;;
a0a3b4
     1)  bondname=$1; bondslaves="eth0 eth1" ;;
a0a3b4
@@ -38,14 +29,13 @@ parsebond() {
a0a3b4
     esac
a0a3b4
 }
a0a3b4
 
a0a3b4
-unset bondname bondslaves bondoptions
a0a3b4
-
a0a3b4
 # Parse bond for bondname, bondslaves, bondmode and bondoptions
a0a3b4
-if getarg bond >/dev/null; then
a0a3b4
-    # Read bond= parameters if they exist
a0a3b4
-    bond="$(getarg bond=)"
a0a3b4
-    if [ ! "$bond" = "bond" ]; then
a0a3b4
-        parsebond "$(getarg bond=)"
a0a3b4
+for bond in $(getargs bond=); do
a0a3b4
+    unset bondname
a0a3b4
+    unset bondslaves
a0a3b4
+    unset bondoptions
a0a3b4
+    if [ "$bond" != "bond" ]; then
a0a3b4
+        parsebond "$bond"
a0a3b4
     fi
a0a3b4
     # Simple default bond
a0a3b4
     if [ -z "$bondname" ]; then
a0a3b4
@@ -57,5 +47,4 @@ if getarg bond >/dev/null; then
a0a3b4
     echo "bondname=$bondname" > /tmp/bond.${bondname}.info
a0a3b4
     echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info
a0a3b4
     echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info
a0a3b4
-    return
a0a3b4
-fi
a0a3b4
+done