2008-09-08 18:54:30 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
package xCAT_plugin::updatenode;
|
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
|
|
|
}
|
|
|
|
use lib "$::XCATROOT/lib/perl";
|
|
|
|
|
|
|
|
use xCAT::Table;
|
|
|
|
use xCAT::Schema;
|
|
|
|
use Data::Dumper;
|
|
|
|
use xCAT::Utils;
|
|
|
|
use Getopt::Long;
|
|
|
|
use xCAT::GlobalDef;
|
|
|
|
use Sys::Hostname;
|
2008-09-25 03:04:56 +00:00
|
|
|
use xCAT::GlobalDef;
|
|
|
|
use xCAT_monitoring::monitorctrl;
|
2008-09-08 18:54:30 +00:00
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
=head1 xCAT_plugin:updatenode
|
|
|
|
=head2 Package Description
|
|
|
|
xCAT plug-in module. It handles the updatenode command.
|
|
|
|
=cut
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
=head3 handled_commands
|
|
|
|
It returns a list of commands handled by this plugin.
|
|
|
|
Arguments:
|
|
|
|
none
|
|
|
|
Returns:
|
|
|
|
a list of commands.
|
|
|
|
=cut
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
sub handled_commands
|
|
|
|
{
|
|
|
|
return {
|
2008-09-25 03:04:56 +00:00
|
|
|
updatenode => "updatenode",
|
|
|
|
updatenodestat => "updatenode"};
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------
|
|
|
|
=head3 preprocess_request
|
|
|
|
Check and setup for hierarchy
|
|
|
|
=cut
|
|
|
|
#-------------------------------------------------------
|
|
|
|
sub preprocess_request
|
|
|
|
{
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
2009-06-04 15:33:44 +00:00
|
|
|
my $subreq = shift;
|
2008-09-08 18:54:30 +00:00
|
|
|
my $command = $request->{command}->[0];
|
2009-07-15 19:12:07 +00:00
|
|
|
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
|
|
|
#if already preprocessed, go straight to request
|
|
|
|
if ($request->{_xcatpreprocessed}->[0] == 1) { return [$request]; }
|
|
|
|
|
2008-09-08 18:54:30 +00:00
|
|
|
my @requests=();
|
|
|
|
|
|
|
|
if ($command eq "updatenode")
|
|
|
|
{
|
2009-06-04 15:33:44 +00:00
|
|
|
return preprocess_updatenode($request, $callback, $subreq);
|
2008-09-25 03:04:56 +00:00
|
|
|
} elsif ($command eq "updatenodestat") {
|
|
|
|
return [$request];
|
|
|
|
}
|
2008-09-08 18:54:30 +00:00
|
|
|
else {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "unsupported command: $command.";
|
|
|
|
$callback->($rsp);
|
|
|
|
return \@requests;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
=head3 process_request
|
|
|
|
It processes the monitoring control commands.
|
|
|
|
Arguments:
|
|
|
|
request -- a hash table which contains the command name and the arguments.
|
|
|
|
callback -- a callback pointer to return the response to.
|
|
|
|
Returns:
|
|
|
|
0 for success. The output is returned through the callback pointer.
|
|
|
|
1. for unsuccess. The error messages are returns through the callback pointer.
|
|
|
|
=cut
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
sub process_request
|
|
|
|
{
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
2009-06-04 15:33:44 +00:00
|
|
|
my $subreq = shift;
|
2008-09-08 18:54:30 +00:00
|
|
|
my $command = $request->{command}->[0];
|
|
|
|
my $localhostname=hostname();
|
|
|
|
|
2008-09-25 03:04:56 +00:00
|
|
|
if ($command eq "updatenode") {
|
2009-06-04 15:33:44 +00:00
|
|
|
return updatenode($request, $callback, $subreq);
|
2008-09-25 03:04:56 +00:00
|
|
|
} elsif ($command eq "updatenodestat") {
|
|
|
|
return updatenodestat($request, $callback);
|
|
|
|
} else {
|
2008-09-08 18:54:30 +00:00
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "$localhostname: unsupported command: $command.";
|
|
|
|
$callback->($rsp);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
=head3 preprocess_updatenode
|
|
|
|
This function checks for the syntax of the updatenode command
|
|
|
|
and distribute the command to the right server.
|
|
|
|
Arguments:
|
|
|
|
request - the request. The request->{arg} is of the format:
|
|
|
|
[-h|--help|-v|--version] or
|
2009-06-04 15:33:44 +00:00
|
|
|
[noderange [-s | -S] [postscripts]]
|
2008-09-08 18:54:30 +00:00
|
|
|
callback - the pointer to the callback function.
|
|
|
|
Returns:
|
|
|
|
A pointer to an array of requests.
|
|
|
|
=cut
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
sub preprocess_updatenode {
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
2009-06-04 15:33:44 +00:00
|
|
|
my $subreq = shift;
|
2008-09-08 18:54:30 +00:00
|
|
|
my $args=$request->{arg};
|
|
|
|
my @requests=();
|
|
|
|
|
|
|
|
# subroutine to display the usage
|
|
|
|
sub updatenode_usage
|
|
|
|
{
|
|
|
|
my $cb=shift;
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "Usage:";
|
2009-07-20 12:50:31 +00:00
|
|
|
$rsp->{data}->[1]= " updatenode [-h|--help|-v|--version]";
|
|
|
|
$rsp->{data}->[2]= " updatenode <noderange> [-V|--verbose] [-F|--sync] [-S|--sw] [-P|--scripts [script1,script2,...]]";
|
|
|
|
$rsp->{data}->[3]= " updatenode <noderange> [-V|--verbose] [script1,script2,...]";
|
|
|
|
$rsp->{data}->[4]= " <noderange> is a list of nodes or groups.";
|
|
|
|
$rsp->{data}->[5]= " -F|--sync: Perform File Syncing.";
|
|
|
|
$rsp->{data}->[6]= " -S|--sw: Perform Software Maintenance.";
|
2009-08-03 11:49:04 +00:00
|
|
|
$rsp->{data}->[7]= " -P|--scripts: Perform Postscripts listed in postscripts table or parameters.";
|
2009-07-20 12:50:31 +00:00
|
|
|
$rsp->{data}->[8]= " [script1,script2,...] is a comma separated list of postscript names.";
|
|
|
|
$rsp->{data}->[9]= " If omitted, all the postscripts defined for the nodes will be run.";
|
2008-09-08 18:54:30 +00:00
|
|
|
$cb->($rsp);
|
|
|
|
}
|
|
|
|
|
|
|
|
@ARGV=();
|
|
|
|
if ($args) {
|
|
|
|
@ARGV=@{$args};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# parse the options
|
|
|
|
Getopt::Long::Configure("bundling");
|
|
|
|
Getopt::Long::Configure("no_pass_through");
|
|
|
|
if(!GetOptions(
|
2009-07-15 13:08:51 +00:00
|
|
|
'h|help' => \$::HELP,
|
2009-06-04 15:33:44 +00:00
|
|
|
'v|version' => \$::VERSION,
|
2009-07-20 06:05:39 +00:00
|
|
|
'V|verbose' => \$::VERBOSE,
|
|
|
|
'F|sync' => \$::FILESYNC,
|
|
|
|
'S|sw' => \$::SWMAINTENANCE,
|
|
|
|
'P|scripts:s' => \$::RERUNPS))
|
2008-09-08 18:54:30 +00:00
|
|
|
{
|
|
|
|
&updatenode_usage($callback);
|
|
|
|
return \@requests;;
|
|
|
|
}
|
|
|
|
|
|
|
|
# display the usage if -h or --help is specified
|
|
|
|
if ($::HELP) {
|
|
|
|
&updatenode_usage($callback);
|
|
|
|
return \@requests;;
|
|
|
|
}
|
|
|
|
|
|
|
|
# display the version statement if -v or --verison is specified
|
|
|
|
if ($::VERSION)
|
|
|
|
{
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= xCAT::Utils->Version();
|
|
|
|
$callback->($rsp);
|
|
|
|
return \@requests;
|
|
|
|
}
|
2009-07-20 06:05:39 +00:00
|
|
|
|
|
|
|
# the -P flag is omitted when only postscritps are specified,
|
|
|
|
# so if there are parameters without any flags, it means
|
|
|
|
# to re-run the postscripts.
|
|
|
|
if (@ARGV) {
|
|
|
|
if ($#ARGV == 0 &&
|
2009-08-03 11:49:04 +00:00
|
|
|
!($::FILESYNC || $::SWMAINTENANCE || defined($::RERUNPS)) ) {
|
2009-07-20 06:05:39 +00:00
|
|
|
$::RERUNPS = $ARGV[0];
|
|
|
|
} else {
|
|
|
|
&updatenode_usage($callback);
|
|
|
|
return \@requests;
|
|
|
|
}
|
2009-08-03 11:49:04 +00:00
|
|
|
} else {
|
|
|
|
if ( !($::FILESYNC || $::SWMAINTENANCE || defined($::RERUNPS)) ) {
|
|
|
|
$::FILESYNC = 1;
|
|
|
|
$::SWMAINTENANCE = 1;
|
|
|
|
$::RERUNPS = "";
|
|
|
|
}
|
2009-07-20 06:05:39 +00:00
|
|
|
}
|
|
|
|
|
2008-09-08 20:59:07 +00:00
|
|
|
my $nodes = $request->{node};
|
|
|
|
if (!$nodes) {
|
|
|
|
&updatenode_usage($callback);
|
|
|
|
return \@requests;;
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
|
|
|
|
2008-09-08 20:59:07 +00:00
|
|
|
my @nodes=@$nodes;
|
|
|
|
my $postscripts;
|
2008-09-08 18:54:30 +00:00
|
|
|
|
|
|
|
if (@nodes == 0) { return \@requests; }
|
|
|
|
|
2009-07-15 13:08:51 +00:00
|
|
|
# handle the re-run postscripts option -P
|
|
|
|
if (defined ($::RERUNPS)) {
|
|
|
|
if ($::RERUNPS eq "") {
|
|
|
|
$postscripts = "";
|
|
|
|
} else {
|
|
|
|
$postscripts=$::RERUNPS;
|
|
|
|
my @posts=split(',',$postscripts);
|
|
|
|
foreach (@posts) {
|
|
|
|
if ( ! -e "/install/postscripts/$_") {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "The postcript /install/postscripts/$_ does not exist.";
|
|
|
|
$callback->($rsp);
|
|
|
|
return \@requests;
|
|
|
|
}
|
2009-06-04 15:33:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-03 11:49:04 +00:00
|
|
|
# If -F option specified, sync files to the noderange.
|
|
|
|
# Note: This action only happens on MN, since xdcp handles the hierarchical scenario
|
|
|
|
if ($::FILESYNC) {
|
|
|
|
my $reqcopy = {%$request};
|
2009-08-12 18:21:36 +00:00
|
|
|
$reqcopy->{FileSyncing}->[0] = "yes";
|
2009-08-03 11:49:04 +00:00
|
|
|
push @requests, $reqcopy;
|
|
|
|
}
|
2009-07-15 13:08:51 +00:00
|
|
|
|
|
|
|
# when specified -S or -P
|
2009-06-09 02:59:16 +00:00
|
|
|
# find service nodes for requested nodes
|
|
|
|
# build an individual request for each service node
|
2009-07-15 13:08:51 +00:00
|
|
|
unless (defined($::SWMAINTENANCE) || defined($::RERUNPS)) {
|
|
|
|
return \@requests;
|
|
|
|
}
|
|
|
|
|
2009-06-09 02:59:16 +00:00
|
|
|
my $sn = xCAT::Utils->get_ServiceNode(\@nodes, "xcat", "MN");
|
|
|
|
|
2008-09-08 20:59:07 +00:00
|
|
|
# build each request for each service node
|
|
|
|
foreach my $snkey (keys %$sn)
|
|
|
|
{
|
2009-08-12 18:21:36 +00:00
|
|
|
#print "sn=$snkey\n";
|
2008-09-08 20:59:07 +00:00
|
|
|
my $reqcopy = {%$request};
|
|
|
|
$reqcopy->{node} = $sn->{$snkey};
|
|
|
|
$reqcopy->{'_xcatdest'} = $snkey;
|
2009-07-15 19:12:07 +00:00
|
|
|
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
|
|
|
|
2009-07-15 13:08:51 +00:00
|
|
|
if (defined ($::SWMAINTENANCE)) {
|
2009-08-12 18:21:36 +00:00
|
|
|
$reqcopy->{swmaintenance}->[0] = "yes";
|
2009-07-15 13:08:51 +00:00
|
|
|
}
|
|
|
|
if (defined ($::RERUNPS)) {
|
2009-08-12 18:21:36 +00:00
|
|
|
$reqcopy->{rerunps}->[0] = "yes";
|
2009-07-15 13:08:51 +00:00
|
|
|
$reqcopy->{postscripts} = [$postscripts];
|
|
|
|
}
|
|
|
|
|
2008-09-08 20:59:07 +00:00
|
|
|
push @requests, $reqcopy;
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
2008-09-08 20:59:07 +00:00
|
|
|
|
2009-07-15 13:08:51 +00:00
|
|
|
return \@requests;
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
=head3 updatenode
|
|
|
|
This function implements the updatenode command.
|
|
|
|
Arguments:
|
|
|
|
request - the request.
|
|
|
|
callback - the pointer to the callback function.
|
|
|
|
Returns:
|
|
|
|
0 for success. The output is returned through the callback pointer.
|
|
|
|
1. for unsuccess. The error messages are returns through the callback pointer.
|
|
|
|
=cut
|
|
|
|
#--------------------------------------------------------------------------------
|
|
|
|
sub updatenode {
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
2009-06-04 15:33:44 +00:00
|
|
|
my $subreq = shift;
|
2009-08-12 18:21:36 +00:00
|
|
|
#print Dumper($request);
|
2009-07-15 13:08:51 +00:00
|
|
|
|
2008-09-08 20:59:07 +00:00
|
|
|
my $nodes =$request->{node};
|
2008-09-08 18:54:30 +00:00
|
|
|
my $localhostname=hostname();
|
|
|
|
|
2009-08-12 18:21:36 +00:00
|
|
|
if ($request->{FileSyncing} && $request->{FileSyncing}->[0] eq "yes") {
|
2009-06-04 15:33:44 +00:00
|
|
|
my %syncfile_node = ();
|
2009-06-19 08:32:47 +00:00
|
|
|
my %syncfile_rootimage = ();
|
2009-07-22 05:59:11 +00:00
|
|
|
my $node_syncfile = xCAT::SvrUtils->getsynclistfile($nodes);
|
2009-06-04 15:33:44 +00:00
|
|
|
foreach my $node (@$nodes) {
|
|
|
|
my $synclist = $$node_syncfile{$node};
|
|
|
|
|
|
|
|
if ($synclist) {
|
|
|
|
push @{$syncfile_node{$synclist}}, $node;
|
2009-06-19 08:32:47 +00:00
|
|
|
}
|
2009-06-04 15:33:44 +00:00
|
|
|
}
|
|
|
|
|
2009-08-24 09:53:55 +00:00
|
|
|
# Check the existence of the synclist file
|
|
|
|
foreach my $synclist (keys %syncfile_node) {
|
|
|
|
if (! (-r $synclist)) {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "The Synclist file $synclist which specified for certain node does NOT existed.";
|
|
|
|
xCAT::MsgUtils->message("E", $rsp, $callback);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-19 08:32:47 +00:00
|
|
|
# Sync files to the target nodes
|
2009-06-04 15:33:44 +00:00
|
|
|
foreach my $synclist (keys %syncfile_node) {
|
2009-09-18 11:21:12 +00:00
|
|
|
if (defined($::VERBOSE)) {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= " Internal call command: xdcp -F $synclist";
|
|
|
|
$callback->($rsp);
|
|
|
|
}
|
2009-06-04 15:33:44 +00:00
|
|
|
my $args = ["-F", "$synclist"];
|
|
|
|
my $env = ["DSH_RSYNC_FILE=$synclist"];
|
|
|
|
$subreq->({command=>['xdcp'], node=>$syncfile_node{$synclist}, arg=>$args, env=>$env}, $callback);
|
|
|
|
}
|
2009-08-03 11:49:04 +00:00
|
|
|
my $rsp={};
|
2009-09-18 11:21:12 +00:00
|
|
|
$rsp->{data}->[0]= "Running of File Syncing has completed.";
|
2009-08-03 11:49:04 +00:00
|
|
|
$callback->($rsp);
|
2009-06-04 15:33:44 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 18:21:36 +00:00
|
|
|
if ($request->{swmaintenance} && $request->{swmaintenance}->[0] eq "yes") {
|
2008-11-09 03:20:21 +00:00
|
|
|
my $cmd;
|
2009-07-15 13:08:51 +00:00
|
|
|
my $nodestring=join(',', @$nodes);
|
2008-09-11 04:43:33 +00:00
|
|
|
if (xCAT::Utils->isLinux()) {
|
2009-07-15 13:08:51 +00:00
|
|
|
$cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcatdsklspost 2 otherpkgs 2>&1";
|
2008-09-11 04:43:33 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-07-15 13:08:51 +00:00
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "Dose not support Software Maintenance for AIX nodes";
|
|
|
|
$callback->($rsp);
|
2008-11-09 03:20:21 +00:00
|
|
|
}
|
2009-09-18 11:21:12 +00:00
|
|
|
|
|
|
|
if (defined($::VERBOSE)) {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= " Internal call command: $cmd";
|
|
|
|
$callback->($rsp);
|
|
|
|
}
|
|
|
|
|
2009-08-03 11:49:04 +00:00
|
|
|
if ($cmd && ! open (CMD, "$cmd |")) {
|
2008-11-09 03:20:21 +00:00
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "Cannot run command $cmd";
|
|
|
|
$callback->($rsp);
|
|
|
|
} else {
|
|
|
|
while (<CMD>) {
|
|
|
|
my $rsp={};
|
2009-08-03 11:49:04 +00:00
|
|
|
my $output = $_;
|
2009-09-18 11:21:12 +00:00
|
|
|
chomp($output);
|
|
|
|
$output =~ s/\\cM//;
|
2009-08-03 11:49:04 +00:00
|
|
|
if ($output =~ /returned from postscript/) {
|
2009-09-18 11:21:12 +00:00
|
|
|
$output =~ s/returned from postscript/Running of Software Maintenance has completed./;
|
2009-08-03 11:49:04 +00:00
|
|
|
}
|
|
|
|
$rsp->{data}->[0]= "$output";
|
2008-11-09 03:20:21 +00:00
|
|
|
$callback->($rsp);
|
|
|
|
}
|
|
|
|
close(CMD);
|
2008-09-11 04:43:33 +00:00
|
|
|
}
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
|
|
|
|
2009-08-12 18:21:36 +00:00
|
|
|
if ($request->{rerunps} && $request->{rerunps}->[0] eq "yes") {
|
2009-07-15 13:08:51 +00:00
|
|
|
my $postscripts="";
|
|
|
|
if (($request->{postscripts}) && ($request->{postscripts}->[0])) { $postscripts=$request->{postscripts}->[0];}
|
|
|
|
|
|
|
|
my $nodestring=join(',', @$nodes);
|
|
|
|
#print "postscripts=$postscripts, nodestring=$nodestring\n";
|
2008-09-08 18:54:30 +00:00
|
|
|
|
2009-07-15 13:08:51 +00:00
|
|
|
if ($nodestring) {
|
|
|
|
my $cmd;
|
|
|
|
if (xCAT::Utils->isLinux()) {
|
|
|
|
$cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcatdsklspost 1 $postscripts 2>&1";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$cmd="XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -e /install/postscripts/xcataixpost -c 1 $postscripts 2>&1";
|
|
|
|
}
|
2009-09-18 11:21:12 +00:00
|
|
|
|
|
|
|
if (defined($::VERBOSE)) {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= " Internal call command: $cmd";
|
|
|
|
$callback->($rsp);
|
|
|
|
}
|
|
|
|
|
2009-07-15 13:08:51 +00:00
|
|
|
if (! open (CMD, "$cmd |")) {
|
|
|
|
my $rsp={};
|
|
|
|
$rsp->{data}->[0]= "Cannot run command $cmd";
|
|
|
|
$callback->($rsp);
|
|
|
|
} else {
|
|
|
|
while (<CMD>) {
|
|
|
|
my $rsp={};
|
2009-08-03 11:49:04 +00:00
|
|
|
my $output = $_;
|
2009-09-18 11:21:12 +00:00
|
|
|
chomp($output);
|
|
|
|
$output =~ s/\\cM//;
|
2009-08-03 11:49:04 +00:00
|
|
|
if ($output =~ /returned from postscript/) {
|
2009-09-18 11:21:12 +00:00
|
|
|
$output =~ s/returned from postscript/Running of postscripts has completed./;
|
2009-08-03 11:49:04 +00:00
|
|
|
}
|
|
|
|
$rsp->{data}->[0]= "$output";
|
2009-07-15 13:08:51 +00:00
|
|
|
$callback->($rsp);
|
|
|
|
}
|
|
|
|
close(CMD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2008-09-08 18:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-25 03:04:56 +00:00
|
|
|
sub updatenodestat {
|
|
|
|
my $request = shift;
|
|
|
|
my $callback = shift;
|
|
|
|
my @nodes=();
|
|
|
|
my @args=();
|
|
|
|
if (ref($request->{node})) {
|
|
|
|
@nodes = @{$request->{node}};
|
|
|
|
} else {
|
|
|
|
if ($request->{node}) { @nodes = ($request->{node}); }
|
|
|
|
}
|
|
|
|
if (ref($request->{arg})) {
|
|
|
|
@args=@{$request->{arg}};
|
|
|
|
} else {
|
|
|
|
@args=($request->{arg});
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((@nodes>0) && (@args>0)) {
|
|
|
|
my %node_status=();
|
|
|
|
my $stat=$args[0];
|
|
|
|
$node_status{$stat}=[];
|
|
|
|
foreach my $node (@nodes) {
|
|
|
|
my $pa=$node_status{$stat};
|
|
|
|
push(@$pa, $node);
|
|
|
|
}
|
2008-11-09 04:01:11 +00:00
|
|
|
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%node_status, 1);
|
2008-09-25 03:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-09-08 18:54:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|