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

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