From c26b23a383aa0ecb5409b143aa93c92c00dcf630 Mon Sep 17 00:00:00 2001 From: wangxiaopeng Date: Tue, 8 Sep 2015 04:11:25 -0400 Subject: [PATCH] Issue 158: fix the generated kernel parameters for OS deployment when osimage.nodebootif is set --- perl-xCAT/xCAT/NetworkUtils.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 9dea7bef6..a5930f961 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2495,7 +2495,12 @@ sub gen_net_boot_params # just use the installnic to generate the nic related kernel parameters my $mac; my $nicname; - + + # set the default nicname to nodebootif from image definition + if ($nodebootif) { + $nicname = $nodebootif; + } + if ((! defined ($installnic)) || ($installnic eq "") || ($installnic =~ /^mac$/i)) { $mac = $macmac; $net_params->{mac} = $mac; @@ -2509,20 +2514,19 @@ sub gen_net_boot_params $net_params->{nicname} = $nicname; $net_params->{mac} = $mac; } - if ($nicname) { + + # if nicname is set and mac.mac is NOT set to , use nicname in the boot parameters + if ($nicname && ! defined ($net_params->{setmac})) { $net_params->{ksdevice} = "ksdevice=$nicname"; $net_params->{ip} = "ip=$nicname:dhcp"; $net_params->{netdev} = "netdev=$nicname"; $net_params->{netdevice} = "netdevice=$nicname"; - $net_params->{ifname} = "ifname=$nicname:$mac"; + $net_params->{ifname} = "ifname=$nicname:$mac"; # todo: may not use mac arbitrary } elsif ($mac) { $net_params->{ksdevice} = "ksdevice=$mac"; $net_params->{BOOTIF} = "BOOTIF=$mac"; $net_params->{bootdev} = "bootdev=$mac"; $net_params->{ip} = "ip=dhcp"; - if ($nodebootif) { - $net_params->{ifname} = "ifname=$nodebootif:$mac"; - } $net_params->{netdevice} = "netdevice=$mac"; }