On 01/22/14 at 01:13pm, Vivek Goyal wrote:
On Mon, Jan 13, 2014 at 06:23:12PM +0800, WANG Chao wrote:
> 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.
Don't call it 100%. It might happen that there are two network cards. One
is serving cluster network and other is service other network where remote
destination is.
Yes, I'll change.
> 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
> +}
Instead of removing duplicates later, why not check for duplicates while
adding it to 40ip.conf file and not add it if same configuration is
already present.
I think either approach is ending up with the same result. But since you and
dyoung both suggest to do that, I'll change.