In the remote dump case, and if fence kdump is configured, it's almost
100% sure that the same network interface will be setup more than once.
One time for network dump, the other times for fence kdump. The result
is we will have two or more duplicated ip= configuration in 40ip.conf.
These are exactly duplicates, however dracut will refuse to continue and
raise a fatal error if there are duplicated configuration for the same
interface. We should simply remove the duplicates to avoid this awkward
situation.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
dracut-module-setup.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 02f0280..725949f 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -179,6 +179,13 @@ kdump_setup_znet() {
echo rd.znet=${NETTYPE},${SUBCHANNELS}${_options} >
${initdir}/etc/cmdline.d/30znet.conf
}
+# Remove duplicate ip configurations in 40ip.conf
+kdump_remove_dupliate_ip_opts() {
+ mv ${initdir}/etc/cmdline.d/40ip.conf ${initdir}/etc/cmdline.d/40ip.conf.tmp
+ sort ${initdir}/etc/cmdline.d/40ip.conf.tmp | uniq >
${initdir}/etc/cmdline.d/40ip.conf
+ rm -f ${initdir}/etc/cmdline.d/40ip.conf.tmp
+}
+
# Setup dracut to bringup a given network interface
kdump_setup_netdev() {
local _netdev=$1
@@ -210,6 +217,10 @@ kdump_setup_netdev() {
echo " ifname=$_netdev:$(kdump_get_mac_addr $_netdev)" >>
${initdir}/etc/cmdline.d/40ip.conf
fi
+ # dracut doesn't allow duplicated configuration for same NIC, even they're
exactly the same.
+ # so we have to filter out the duplicates.
+ kdump_remove_dupliate_ip_opts
+
kdump_setup_dns "$_netdev"
}
--
1.8.4.2