[kexec-tools] Respect bonding mode

Dave Young yangrr at fedoraproject.org
Thu Jul 5 09:01:07 UTC 2012


commit f9c56b3f6ea9bd93f04ae3e5a88b8a0d881bb59e
Author: Cong Wang <amwang at redhat.com>
Date:   Mon Jun 25 19:46:39 2012 +0800

    Respect bonding mode
    
    Update: use /sys/class/net/bondX/bonding/mode
    
    We should set the mode of the bonding properly
    in the second kernel too.
    
    Cc: Vivek Goyal <vgoyal at redhat.com>
    Signed-off-by: Cong Wang <amwang at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>

 dracut-module-setup.sh |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 2b829f0..8c4942c 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -67,14 +67,20 @@ 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 " bond=$_netdev:$(sed -e 's/ /,/g' /sys/class/net/$_netdev/bonding/slaves)" >> ${initdir}/etc/cmdline.d/42bond.conf
-    #TODO
-    #echo "bondoptions=\"$bondoptions\"" >> ${initdir}/etc/cmdline.d/42bond.conf
+    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
 }
 
 kdump_setup_vlan() {


More information about the scm-commits mailing list