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

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