diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index a6c259648..7f31643dd 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -5,6 +5,7 @@ use Sys::Syslog; use Socket; use File::Copy; +my $addkcmdlinehandled; my $request; my $callback; my $dhcpconf = "/etc/dhcpd.conf"; @@ -66,6 +67,10 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); + if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for + #most generic, least code duplication + $kern->{kcmdline} .= " ".$kern->{addkcmdline}; + } if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn = xCAT::Utils->my_ip_facing($node); unless ($ipfn) { @@ -80,7 +85,7 @@ sub setstate { } ); } - $kern->{kcmdline} =~ s/!myipfn!/$ipfn/; + $kern->{kcmdline} =~ s/!myipfn!/$ipfn/g; } my $pcfg; open($pcfg,'>',$tftpdir."/pxelinux.cfg/".$node); @@ -168,7 +173,6 @@ sub setstate { my $errored = 0; sub pass_along { my $resp = shift; - $callback->($resp); if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) { $errored=1; } @@ -176,7 +180,12 @@ sub pass_along { if ($_->{error} or $_->{errorcode}) { $errored=1; } + if ($_->{_addkcmdlinehandled}) { + $addkcmdlinehandled->{$_->{name}->[0]}=1; + return; #Don't send back to client this internal hint + } } + $callback->($resp); } @@ -324,7 +333,7 @@ sub process_request { my $bptab = xCAT::Table->new('bootparams',-create=>1); my $chaintab = xCAT::Table->new('chain'); my $mactab = xCAT::Table->new('mac'); #to get all the hostnames - my %bphash = %{$bptab->getNodesAttribs(\@nodes,[qw(kernel initrd kcmdline)])}; + my %bphash = %{$bptab->getNodesAttribs(\@nodes,[qw(kernel initrd kcmdline addkcmdline)])}; my %chainhash = %{$chaintab->getNodesAttribs(\@nodes,[qw(currstate)])}; my %machash = %{$mactab->getNodesAttribs(\@nodes,[qw(mac)])}; foreach (@nodes) {