update database immediately for defect 3785

This commit is contained in:
lissav 2013-09-18 06:40:32 -04:00
parent f91600c359
commit 1f5e0fde43

View File

@ -1131,23 +1131,26 @@ sub updatenode
waitpid($_, 0);
}
}
# update the node status, this is done when -F -S -P are run
# make sure the nodes only appear in one array good or bad
&cleanstatusarrays;
if(@::SUCCESSFULLNODES)
{
# if immediate return of status not requested (PCM), then update the DB here
# in one transaction, otherwise it is updated in getdata callback and buildnodestatus
if (!(defined($request->{status})) || ($request->{status} ne "yes")) {
# update the node status, this is done when -F -S -P are run
# make sure the nodes only appear in one array good or bad
&cleanstatusarrays;
if(@::SUCCESSFULLNODES)
{
my $stat="synced";
xCAT::TableUtils->setUpdateStatus(\@::SUCCESSFULLNODES, $stat);
}
if(@::FAILEDNODES)
{
}
if(@::FAILEDNODES)
{
my $stat="failed";
xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat);
}
}
# if site.precreatemypostscripts = not 1 or yes or undefined,
# remove all the
@ -1486,6 +1489,11 @@ sub buildnodestatus
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;
@ -1500,6 +1508,11 @@ sub buildnodestatus
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer
next;
@ -1720,7 +1733,12 @@ sub getdata
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;
@ -1739,9 +1757,14 @@ sub getdata
my ($node,$info) = split (/:/, $output);
if ($alreadyinstalled == 0) { # not an already install error, then real error
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer
next;
@ -1753,6 +1776,11 @@ sub getdata
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;