From 999870558bbe50a2bb088b0d7b8d7eb1a81a4ea7 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sun, 10 Jun 2012 18:24:35 +0800 Subject: [PATCH] fix and refactor bond handling code This patch fixes dumping over a bonding interface, we should pass ifname= for all its underlying slaves, which is required by dracut. And it separates the code into a different function. Cc: Vivek Goyal Signed-off-by: Cong Wang Acked-by: Dave Young --- dracut-module-setup.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ab9675f..0938121 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -63,6 +63,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_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 +} + # Setup dracut to bringup a given network interface kdump_setup_netdev() { local _netdev=$1 @@ -81,9 +91,7 @@ kdump_setup_netdev() { if kdump_is_bridge "$_netdev"; then kdump_setup_bridge "$_netdev" elif kdump_is_bond "$_netdev"; then - echo " bond=$_netdev:\"$(cat /sys/class/net/$_netdev/bonding/slaves)\"" > ${initdir}/etc/cmdline.d/42bond.conf - #TODO - #echo "bondoptions=\"$bondoptions\"" >> /tmp/$$-bond + kdump_setup_bond "$_netdev" else echo -n " ip=${_static}$_netdev:${_proto}" > ${initdir}/etc/cmdline.d/40ip.conf echo " ifname=$_netdev:$(kdump_get_mac_addr $_netdev)" >> ${initdir}/etc/cmdline.d/40ip.conf