[kexec-tools/f19] Fix bonding options syntax and get all specified options from ifcfg file.

Baoquan He baoquan at fedoraproject.org
Wed May 22 01:55:54 UTC 2013


commit aff5f1bf96b7cd4f1660e7bf111fbb4603e65d29
Author: WANG Chao <chaowang at redhat.com>
Date:   Mon Apr 8 18:02:20 2013 +0800

    Fix bonding options syntax and get all specified options from ifcfg file.
    
    drauct takes bond=<bondname>[:<bondslaves>:[:<options>]] syntax to parse
    bond. For example:
     bond=bond0:eth0,eth1:mode=balance-rr
    
    Update v2:
    - Get bonding options from corresponding ifcfg. Because it's hard to keep
      track of all the runtime configurable options under /sys/class/net/$netif/
    - Remove kdump_get_bond_mode, since it's useless now.
    
    Signed-off-by: WANG Chao <chaowang at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>
    Acked-by: Baoquan He <bhe at redhat.com>

 dracut-module-setup.sh |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 9847d75..4b0852a 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -96,20 +96,16 @@ kdump_setup_bridge() {
     echo " bridge=$_netdev:$(cd /sys/class/net/$_netdev/brif/; echo * | sed -e 's/ /,/g')" >> ${initdir}/etc/cmdline.d/41bridge.conf
 }
 
-kdump_get_bond_mode() {
-    local _dev=$1
-    awk '{print $2}' /sys/class/net/$_dev/bonding/mode
-}
-
 kdump_setup_bond() {
     local _netdev=$1
     for _dev in `cat /sys/class/net/$_netdev/bonding/slaves`; do
         echo -n " ifname=$_dev:$(kdump_get_mac_addr $_dev)" >> ${initdir}/etc/cmdline.d/42bond.conf
     done
     echo -n " bond=$_netdev:$(sed -e 's/ /,/g' /sys/class/net/$_netdev/bonding/slaves)" >> ${initdir}/etc/cmdline.d/42bond.conf
-    #TODO: get other options as well
-    bondoptions="mode=$(kdump_get_bond_mode $_netdev)"
-    echo " bondoptions=\"$bondoptions\"" >> ${initdir}/etc/cmdline.d/42bond.conf
+    # Get bond options specified in ifcfg
+    . /etc/sysconfig/network-scripts/ifcfg-$_netdev
+    bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')"
+    echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf
 }
 
 kdump_setup_team() {


More information about the scm-commits mailing list