mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
Use bulk operation to update chain table for multiple nodes
Do not query bootparams table in yaboot patial-issue: #2024
This commit is contained in:
parent
34296b9229
commit
e05f183a8f
@ -397,6 +397,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)]);
|
||||
@ -416,9 +417,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") {
|
||||
@ -599,18 +601,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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user