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@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
This commit is contained in:
WANG Chao 2013-04-08 18:02:20 +08:00 committed by Baoquan He
parent fe96b47828
commit 0455b7035e

View File

@ -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() {