diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 4cdf82c10..0fc2da096 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -172,6 +172,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$req->{bootparams}}; my $globaltftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; my @args = @{ $req->{arg} } if (exists($req->{arg})); @@ -232,7 +233,6 @@ sub mknetboot my %donetftp = (); my %oents = %{ $ostab->getNodesAttribs(\@nodes, [qw(os arch profile provmethod)]) }; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -249,8 +249,6 @@ sub mknetboot $stateHash = $statetab->getNodesAttribs(\@nodes, ['statemnt']); } - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); # Warning message for nodeset install/netboot/statelite foreach my $knode (keys %oents) @@ -950,15 +948,9 @@ sub mknetboot $kcmdline .= " MNTOPTS=$mntoptions"; } } - - $bptab->setNodeAttribs( - $node, - { - kernel => $kernstr, - initrd => $initrdstr, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernstr; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } @@ -971,6 +963,7 @@ sub mkinstall my @nodes = @{ $request->{node} }; my $noupdateinitrd = $request->{'noupdateinitrd'}; my $ignorekernelchk = $request->{'ignorekernelchk'}; + my $bootparams = ${$request->{bootparams}}; #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -1023,7 +1016,6 @@ sub mkinstall my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'profile', 'os', 'arch', 'provmethod' ]) }; @@ -1033,8 +1025,6 @@ sub mkinstall [ 'serialport', 'serialspeed', 'serialflow' ]) }; my %macents = %{ $mactab->getNodesAttribs(\@nodes, ['mac']) }; - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); require xCAT::Template; # Warning message for nodeset install/netboot/statelite @@ -1668,14 +1658,9 @@ sub mkinstall xCAT::MsgUtils->trace($verbose_on_off, "d", "anaconda->mkinstall: kcmdline=$kcmdline kernal=$k initrd=$i"); - $bptab->setNodeAttribs( - $node, - { - kernel => $k, - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $k; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { @@ -1701,6 +1686,7 @@ sub mksysclone my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $linuximagetab; my $osimagetab; my %img_hash = (); @@ -1727,7 +1713,6 @@ sub mksysclone my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -2064,15 +2049,9 @@ sub mksysclone $k = "xcat/$kernpath"; $i = "xcat/$initrdpath"; - - $bptab->setNodeAttribs( - $node, - { - kernel => $k, - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $k; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 89c405cbf..8260874ea 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -445,6 +445,7 @@ sub mkinstall { my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $sitetab = xCAT::Table->new('site'); my $linuximagetab; my $osimagetab; @@ -490,7 +491,6 @@ sub mkinstall { my $ostab = xCAT::Table->new('nodetype'); my %donetftp; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'profile', 'os', 'arch', 'provmethod' ]) }; @@ -502,8 +502,6 @@ sub mkinstall { [ 'serialport', 'serialspeed', 'serialflow' ]) }; my %macents = %{ $mactab->getNodesAttribs(\@nodes, ['mac']) }; - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); require xCAT::Template; # Warning message for nodeset install/netboot/statelite @@ -923,10 +921,9 @@ sub mkinstall { } xCAT::MsgUtils->trace($verbose_on_off, "d", "debian->mkinstall: kcmdline=$kcmdline kernal=$rtftppath/vmlinuz initrd=$rtftppath/initrd.img"); - - $bptab->setNodeAttribs($node, { kernel => "$rtftppath/vmlinuz", - initrd => "$rtftppath/initrd.img", - kcmdline => $kcmdline }); + $bootparams->{$node}->[0]->{kernel} = "$rtftppath/vmlinuz"; + $bootparams->{$node}->[0]->{initrd} = "$rtftppath/initrd.img"; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { $callback->({ error => ["Install image not found in $installroot/$os/$arch"], @@ -945,6 +942,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$req->{bootparams}}; my $tftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; my @args = @{ $req->{arg} }; @@ -991,7 +989,6 @@ sub mknetboot my %donetftp = (); my %oents = %{ $ostab->getNodesAttribs(\@nodes, [qw(os arch profile provmethod)]) }; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $mactab = xCAT::Table->new('mac'); @@ -1008,9 +1005,6 @@ sub mknetboot $stateHash = $statetab->getNodesAttribs(\@nodes, ['statemnt']); } - #my $addkcmdhash = - # $bptab->getNodesAttribs(\@nodes, ['addkcmdline']); - # Warning message for nodeset install/netboot/statelite foreach my $knode (keys %oents) { my $ent = $oents{$knode}->[0]; @@ -1589,15 +1583,9 @@ sub mknetboot $kcmdline .= " MNTOPTS=$mntoptions"; } } - - $bptab->setNodeAttribs( - $node, - { - kernel => "$kernstr", - initrd => "$initrdstr", - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernstr; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } #my $rc = xCAT::TableUtils->create_postscripts_tar(); diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 3cf5ed2e0..54a7804c7 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -26,7 +26,6 @@ my $errored = 0; #DESTINY SCOPED GLOBALS my $chaintab; my $iscsitab; -my $bptab; my $typetab; my $restab; @@ -94,6 +93,7 @@ sub setdestiny { my $noupdate = shift; $chaintab = xCAT::Table->new('chain', -create => 1); my @nodes = @{ $req->{node} }; + my $bphash = $req->{bootparams}; @ARGV = @{ $req->{arg} }; my $noupdateinitrd; @@ -157,7 +157,6 @@ sub setdestiny { unless ($iscsitab) { $callback->({ error => "Unable to open iscsi table to get iscsiboot parameters", errorcode => [1] }); } - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $nodetype = xCAT::Table->new('nodetype'); my $ntents = $nodetype->getNodesAttribs($req->{node}, [qw(os arch profile)]); my $ients = $iscsitab->getNodesAttribs($req->{node}, [qw(kernel kcmdline initrd)]); @@ -168,11 +167,9 @@ sub setdestiny { unless ($ntent and $ntent->{arch} =~ /x86/ and -f ("$tftpdir/undionly.kpxe" or -f "$tftpdir/xcat/xnba.kpxe")) { $callback->({ error => "$_: No iscsi boot data available", errorcode => [1] }); } #If x86 node and undionly.kpxe exists, presume they know what they are doing next; } - my $hash; - $hash->{kernel} = $ient->{kernel}; - if ($ient->{initrd}) { $hash->{initrd} = $ient->{initrd} } - if ($ient->{kcmdline}) { $hash->{kcmdline} = $ient->{kcmdline} } - $bptab->setNodeAttribs($_, $hash); + $bphash->{kernel} = $ient->{kernel}; + if ($ient->{initrd}) { $bphash->{initrd} = $ient->{initrd} } + if ($ient->{kcmdline}) { $bphash->{kcmdline} = $ient->{kcmdline} } } } elsif ($state =~ /^install[=\$]/ or $state eq 'install' or $state =~ /^netboot[=\$]/ or $state eq 'netboot' or $state eq "image" or $state eq "winshell" or $state =~ /^osimage/ or $state =~ /^statelite/) { my %state_hash; @@ -389,7 +386,8 @@ sub setdestiny { $subreq->({ command => ["mk$tempstate"], node => $samestatenodes, noupdateinitrd => $noupdateinitrd, - ignorekernelchk => $ignorekernelchk, }, \&relay_response); + ignorekernelchk => $ignorekernelchk, + bootparams => \$bphash}, \&relay_response); if ($errored) { my @myself = xCAT::NetworkUtils->determinehostname(); my $myname = $myself[ (scalar @myself) - 1 ]; @@ -400,6 +398,7 @@ sub setdestiny { my $ntents = $nodetypetable->getNodesAttribs($samestatenodes, [qw(os arch profile)]); + my $updates; foreach (@{$samestatenodes}) { $nstates{$_} = $tempstate; #local copy of state variable for mod my $ntent = $ntents->{$_}->[0]; #$nodetype->getNodeAttribs($_,[qw(os arch profile)]); @@ -419,9 +418,10 @@ sub setdestiny { } else { $errored = 1; $callback->({ errorcode => [1], error => "nodetype.profile not defined for $_" }); } } if ($errored) { return; } - - #statelite - unless ($tempstate =~ /^netboot|^statelite/) { $chaintab->setNodeAttribs($_, { currchain => "boot" }); } + $updates->{$_}->{'currchain'} = "boot"; + } + unless ($tempstate =~ /^netboot|^statelite/) { + $chaintab->setNodesAttribs($updates); } if ($action eq "reboot4deploy") { @@ -437,7 +437,6 @@ sub setdestiny { } } elsif ($state eq "shell" or $state eq "standby" or $state =~ /^runcmd/ or $state =~ /^runimage/) { $restab = xCAT::Table->new('noderes', -create => 1); - my $bootparms = xCAT::Table->new('bootparams', -create => 1); my $nodetype = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); @@ -509,18 +508,18 @@ sub setdestiny { } } if (-r "$tftpdir/xcat/genesis.fs.$arch.$bestsuffix") { - $bootparms->setNodeAttribs($_, { kernel => "xcat/genesis.kernel.$arch", - initrd => "xcat/genesis.fs.$arch.$bestsuffix", - kcmdline => $kcmdline . "xcatd=$master:$xcatdport destiny=$state" }); + $bphash->{$_}->[0]->{kernel} = "xcat/genesis.kernel.$arch"; + $bphash->{$_}->[0]->{initrd} = "xcat/genesis.fs.$arch.$bestsuffix"; + $bphash->{$_}->[0]->{kcmdline} = $kcmdline . "xcatd=$master:$xcatdport destiny=$state"; } else { - $bootparms->setNodeAttribs($_, { kernel => "xcat/genesis.kernel.$arch", - initrd => "xcat/genesis.fs.$arch.$othersuffix", - kcmdline => $kcmdline . "xcatd=$master:$xcatdport destiny=$state" }); + $bphash->{$_}->[0]->{kernel} = "xcat/genesis.kernel.$arch"; + $bphash->{$_}->[0]->{initrd} = "xcat/genesis.fs.$arch.$othersuffix"; + $bphash->{$_}->[0]->{kcmdline} = $kcmdline . "xcatd=$master:$xcatdport destiny=$state"; } } else { #'legacy' environment - $bootparms->setNodeAttribs($_, { kernel => "xcat/nbk.$arch", - initrd => "xcat/nbfs.$arch.gz", - kcmdline => $kcmdline . "xcatd=$master:$xcatdport" }); + $bphash->{$_}->[0]->{kernel} = "xcat/nbk.$arch"; + $bphash->{$_}->[0]->{initrd} = "xcat/nkfs.$arch.gz"; + $bphash->{$_}->[0]->{kcmdline} = $kcmdline . "xcatd=$master:$xcatdport"; } } @@ -603,18 +602,20 @@ sub setdestiny { } if ($noupdate) { return; } #skip table manipulation if just doing 'enact' + my $updates; foreach (@nodes) { my $lstate = $state; if ($nstates{$_}) { $lstate = $nstates{$_}; } - $chaintab->setNodeAttribs($_, { currstate => $lstate }); + $updates->{$_}->{'currstate'} = $lstate; # if there are multiple actions in the state argument, set the rest of states (shift out the first one) # to chain.currchain so that the rest ones could be used by nextdestiny command if ($reststates) { - $chaintab->setNodeAttribs($_, { currchain => $reststates }); + $updates->{$_}->{'currchain'} = $reststates; } + $chaintab->setNodesAttribs($updates); } return getdestiny($flag + 1); } @@ -747,7 +748,7 @@ sub getdestiny { my $chaintab = xCAT::Table->new('chain'); my $chainents = $chaintab->getNodesAttribs(\@nodes, [qw(currstate chain)]); my $nrents = $restab->getNodesAttribs(\@nodes, [qw(tftpserver xcatmaster)]); - $bptab = xCAT::Table->new('bootparams', -create => 1); + my $bptab = xCAT::Table->new('bootparams', -create => 1); my $bpents = $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline xcatmaster)]); #my $sitetab= xCAT::Table->new('site'); diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index d12b2224a..25446d0e1 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -570,17 +570,18 @@ sub process_request { if (exists($request->{inittime})) { $inittime = $request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "grub2: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - my $bphash = $bptab->getNodesAttribs(\@nodes, [ 'kernel', 'initrd', 'kcmdline', 'addkcmdline' ]); my $chaintab = xCAT::Table->new('chain', -create => 1); my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']); my $noderestab = xCAT::Table->new('noderes', -create => 1); @@ -617,7 +618,7 @@ sub process_request { $linuximghash = $linuximgtab->getAttribs({ imagename => $osimgname }, 'boottarget', 'addkcmdline'); } - ($rc, $errstr) = setstate($_, $bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); + ($rc, $errstr) = setstate($_, \%bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; $response{node}->[0]->{errorc}->[0] = $errstr; diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 3d3d7fa6d..cea7eeaea 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -460,12 +460,15 @@ sub process_request { if (exists($request->{inittime})) { $inittime = $request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "petitboot: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash}, + \&pass_along); } if ($errored) { return; } @@ -476,8 +479,6 @@ sub process_request { arg => ['default'] }); xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: clear node(s): @nodes boot device setting."); } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - my $bphash = $bptab->getNodesAttribs(\@nodes, [ 'kernel', 'initrd', 'kcmdline', 'addkcmdline' ]); my $chaintab = xCAT::Table->new('chain', -create => 1); my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']); my $noderestab = xCAT::Table->new('noderes', -create => 1); @@ -510,7 +511,7 @@ sub process_request { my $linuximghash = $linuximghash = $linuximgtab->getAttribs({ imagename => $osimgname }, 'boottarget', 'addkcmdline'); - ($rc, $errstr) = setstate($_, $bphash, $chainhash, $machash, $tftpdir, $nodereshash, $linuximghash); + ($rc, $errstr) = setstate($_, \%bphash, $chainhash, $machash, $tftpdir, $nodereshash, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; $response{node}->[0]->{errorc}->[0] = $errstr; diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 4b0d937dc..f35afae12 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -497,6 +497,7 @@ sub process_request { $errored = 0; + my %bphash; my $inittime = 0; if (exists($::PXE_request->{inittime})) { $inittime = $::PXE_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -505,19 +506,19 @@ sub process_request { $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - 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 $typetab = xCAT::Table->new('nodetype'); my $restab = xCAT::Table->new('noderes'); my $linuximgtab = xCAT::Table->new('linuximage', -create => 1); my %nrhash = %{ $restab->getNodesAttribs(\@nodes, [qw(tftpdir)]) }; - my %bphash = %{ $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %machash = %{ $mactab->getNodesAttribs(\@nodes, [qw(mac)]) }; my %nthash = %{ $typetab->getNodesAttribs(\@nodes, [qw(os provmethod)]) }; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index d564f74eb..12d560770 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -54,6 +54,7 @@ sub mknetboot if ($req->{command}->[0] =~ 'mkstatelite') { $statelite = "true"; } + my $bootparams = ${$req->{bootparams}}; my $globaltftpdir = "/tftpboot"; my $nodes = @{ $req->{node} }; @@ -445,7 +446,6 @@ sub mknetboot } # TODO: move the table operations out of the foreach loop - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $sent = $hmtab->getNodeAttribs($node, @@ -720,13 +720,9 @@ sub mknetboot $kcmdline .= "MNTOPTS=\'$mntoptions\'"; } } - $bptab->setNodeAttribs( - $node, - { - kernel => "$rtftppath/kernel", - initrd => $initrdstr, - kcmdline => $kcmdline - }); + $bootparams->{$node}->[0]->{kernel} = "$rtftppath/kernel"; + $bootparams->{$node}->[0]->{initrd} = $initrdstr; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } @@ -770,6 +766,7 @@ sub mkinstall my $noupdateinitrd = $request->{'noupdateinitrd'}; my $ignorekernelchk = $request->{'ignorekernelchk'}; + my $bootparams = ${$request->{bootparams}}; my @nodes = @{ $request->{node} }; my $node; my $ostab = xCAT::Table->new('nodetype'); @@ -799,7 +796,6 @@ sub mkinstall my $installroot; $installroot = "/install"; my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my $resents = $restab->getNodesAttribs( @@ -1365,14 +1361,9 @@ sub mkinstall $kernelpath = "$rtftppath/linux"; $initrdpath = "$rtftppath/initrd"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd=$initrdpath"); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => $initrdpath, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = $initrdpath; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } elsif ($arch eq "ppc64") { @@ -1384,14 +1375,9 @@ sub mkinstall $kernelpath = "$rtftppath/linux64"; $initrdpath = "$rtftppath/initrd64"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd=$initrdpath"); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => $initrdpath, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = $initrdpath; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } elsif (-r "$tftppath/inst64") { @@ -1399,14 +1385,9 @@ sub mkinstall #suseboot/inst64 can not be run on Power8 BE $kernelpath = "$rtftppath/inst64"; xCAT::MsgUtils->trace($verbose_on_off, "d", "sles->mkinstall: kcmdline=$kcmdline kernal=$kernelpath initrd="); - $bptab->setNodeAttribs( - $node, - { - kernel => $kernelpath, - initrd => "", - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = $kernelpath; + $bootparams->{$node}->[0]->{initrd} = ""; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } } } @@ -1436,6 +1417,7 @@ sub mksysclone my $callback = shift; my $doreq = shift; my @nodes = @{ $request->{node} }; + my $bootparams = ${$request->{bootparams}}; my $osimagetab; my %img_hash = (); @@ -1460,7 +1442,6 @@ sub mksysclone my $node; my $ostab = xCAT::Table->new('nodetype'); my $restab = xCAT::Table->new('noderes'); - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $hmtab = xCAT::Table->new('nodehm'); my %osents = %{ $ostab->getNodesAttribs(\@nodes, [ 'os', 'arch', 'provmethod' ]) }; my %rents = @@ -1645,14 +1626,9 @@ sub mksysclone if (-r "$tftpdir/xcat/genesis.fs.$arch.lzma") { $i = "xcat/genesis.fs.$arch.lzma"; } - $bptab->setNodeAttribs( - $node, - { - kernel => "xcat/genesis.kernel.$arch", - initrd => $i, - kcmdline => $kcmdline - } - ); + $bootparams->{$node}->[0]->{kernel} = "xcat/genesis.kernel.$arch"; + $bootparams->{$node}->[0]->{initrd} = $i; + $bootparams->{$node}->[0]->{kcmdline} = $kcmdline; } else { diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index 60e0cab30..aa22a24ed 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -402,6 +402,7 @@ sub process_request { $errored = 0; + my %bphash; my $inittime = 0; if (exists($::VSMPPXE_request->{inittime})) { $inittime = $::VSMPPXE_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -409,15 +410,15 @@ sub process_request { $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => [ $args[0] ] }, \&pass_along); + arg => [ $args[0] ], + bootparams => \%bphash + }, \&pass_along); } if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - 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 addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %machash = %{ $mactab->getNodesAttribs(\@nodes, [qw(mac)]) }; foreach (@nodes) { diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index bdf93d294..fc485dd4e 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -108,7 +108,7 @@ sub setstate { my $linuximghashref = shift; if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; } my $imgaddkcmdline = ($linuximghash{'boottarget'}) ? undef : $linuximghash{'addkcmdline'}; - my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); + my $kern = $bphash{$node}->[0]; unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline if ($kern->{addkcmdline} or ($imgaddkcmdline)) { @@ -520,22 +520,24 @@ sub process_request { if (exists($::XNBA_request->{inittime})) { $inittime = $::XNBA_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args , + bootparams => \%bphash}, + \&pass_along); } + if ($errored) { return; } #Time to actually configure the nodes, first extract database data with the scalable calls - my $bptab = xCAT::Table->new('bootparams', -create => 1); my $chaintab = xCAT::Table->new('chain'); my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories my $mactab = xCAT::Table->new('mac'); #to get all the hostnames my %nrhash = %{ $noderestab->getNodesAttribs(\@nodes, [qw(tftpdir)]) }; - my %bphash = %{ $bptab->getNodesAttribs(\@nodes, [qw(kernel initrd kcmdline addkcmdline)]) }; my %chainhash = %{ $chaintab->getNodesAttribs(\@nodes, [qw(currstate)]) }; my %iscsihash; my $iscsitab = xCAT::Table->new('iscsi'); diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index a1bde29f0..8e8ac37c9 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -95,7 +95,7 @@ sub setstate { my $tftpdir = shift; my %nrhash = %{ shift() }; my $linuximghash = shift(); - my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); + my $kern = $bphash{$node}->[0]; if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn; my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node); @@ -567,17 +567,18 @@ sub process_request { if (exists($::YABOOT_request->{inittime})) { $inittime = $::YABOOT_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } $errored = 0; + my %bphash; unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') { xCAT::MsgUtils->trace($verbose_on_off, "d", "yaboot: issue setdestiny request"); $sub_req->({ command => ['setdestiny'], node => \@nodes, inittime => [$inittime], - arg => \@args }, \&pass_along); + arg => \@args, + bootparams => \%bphash}, + \&pass_along); } if ($errored) { return; } - my $bptab = xCAT::Table->new('bootparams', -create => 1); - my $bphash = $bptab->getNodesAttribs(\@nodes, [ 'kernel', 'initrd', 'kcmdline', 'addkcmdline' ]); my $chaintab = xCAT::Table->new('chain', -create => 1); my $chainhash = $chaintab->getNodesAttribs(\@nodes, ['currstate']); my $noderestab = xCAT::Table->new('noderes', -create => 1); @@ -614,7 +615,7 @@ sub process_request { $linuximghash = $linuximgtab->getAttribs({ imagename => $osimgname }, 'boottarget', 'addkcmdline'); } - ($rc, $errstr) = setstate($_, $bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); + ($rc, $errstr) = setstate($_, \%bphash, $chainhash, $machash, $tftpdir, $nrhash, $linuximghash); if ($rc) { $response{node}->[0]->{errorcode}->[0] = $rc; $response{node}->[0]->{errorc}->[0] = $errstr;