From 9bdc49c33ecc0330838e9c61d21ea7ef5826c718 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 21 Sep 2010 20:42:12 +0000 Subject: [PATCH] -Fix anaconda plugin for rhel6 and also fix auto-detect function git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7564 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 84bc77f4d..c424284fa 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -512,34 +512,36 @@ sub mknetboot # add one parameter: ifname=: # which is used for dracut # the redhat5.x os will ignore it - $kcmdline .= "ifname="; + my $useifname=0; if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}) { if ($reshash->{$node}->[0]->{installnic} ne "mac") { - $kcmdline .= $reshash->{$node}->[0]->{installnic} . ":"; + $useifname=1; + $kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":"; } } elsif ($nodebootif) { - $kcmdline .= "$nodebootif:"; + $useifname=1; + $kcmdline .= "ifname=$nodebootif:"; } elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic}) { - $kcmdline .= "$primarynic:"; - } - else { - $kcmdline .="eth0:"; - print "eth0 is used as the default booting network devices...\n"; + $useifname=1; + $kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":"; } + #else { #no, we autodetect and don't presume anything + # $kcmdline .="eth0:"; + # print "eth0 is used as the default booting network devices...\n"; + #} # append the mac address my $mac; - if($machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { + if($useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { # TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used $mac = $machash->{$node}->[0]->{'mac'}; if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) { - $kcmdline .= "$mac"; + $kcmdline .= "$mac "; } else { - print qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset netboot|statelite".}; + die qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset netboot|statelite if installnic/primarynic is set".}; } - } else { # it should never happen - $callback->({error=>["cannot find the mac address for $node in mac table"], errorcode=>[1]}); + #} else { # it should never happen, but we don't always do it this way + # $callback->({error=>["cannot find the mac address for $node in mac table"], errorcode=>[1]}); } - $kcmdline .= " "; # add "netdev=" or "BOOTIF=" my $netdev = "";