2009-11-24 15:12:39 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
|
|
|
package xCAT_plugin::AAAusage;
|
|
|
|
use strict;
|
2012-02-19 16:09:21 +00:00
|
|
|
use xCAT::Usage;
|
2009-11-24 15:12:39 +00:00
|
|
|
##########################################################################
|
|
|
|
# Common help plugin for table-driven commands
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Command handler method from tables
|
|
|
|
##########################################################################
|
|
|
|
sub handled_commands {
|
|
|
|
return {
|
|
|
|
rnetboot => 'AAAusage',
|
|
|
|
rpower => 'AAAusage',
|
|
|
|
rbeacon => 'AAAusage',
|
|
|
|
rvitals => 'AAAusage',
|
|
|
|
reventlog => 'AAAusage',
|
|
|
|
rinv => 'AAAusage',
|
|
|
|
rsetboot => 'AAAusage',
|
|
|
|
rbootseq => 'AAAusage',
|
|
|
|
rscan => 'AAAusage',
|
|
|
|
rspconfig => 'AAAusage',
|
|
|
|
getmacs => 'AAAusage',
|
|
|
|
mkvm => 'AAAusage',
|
|
|
|
lsvm => 'AAAusage',
|
|
|
|
chvm => 'AAAusage',
|
|
|
|
rmvm => 'AAAusage',
|
2010-11-07 06:27:54 +00:00
|
|
|
#lsslp => 'AAAusage',
|
2009-11-24 15:12:39 +00:00
|
|
|
rflash => 'AAAusage',
|
|
|
|
mkhwconn => 'AAAusage',
|
|
|
|
rmhwconn => 'AAAusage',
|
|
|
|
lshwconn => 'AAAusage',
|
2010-08-12 09:07:05 +00:00
|
|
|
renergy => 'AAAusage',
|
|
|
|
nodeset => 'AAAusage'
|
2009-11-24 15:12:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Pre-process request from xCat daemon
|
|
|
|
##########################################################################
|
|
|
|
sub preprocess_request {
|
|
|
|
my $request = shift;
|
|
|
|
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
|
|
|
|
|
|
|
if (($request->{_xcatpreprocessed}) and ($request->{_xcatpreprocessed}->[0] == 1) ) { return [$request]; }
|
|
|
|
my $callback=shift;
|
|
|
|
my @requests;
|
|
|
|
|
|
|
|
#display usage statement if -h is present or no noderage is specified
|
|
|
|
my $noderange = $request->{node}; #Should be arrayref
|
|
|
|
my $command = $request->{command}->[0];
|
|
|
|
my $extrargs = $request->{arg};
|
|
|
|
my @exargs=($request->{arg});
|
|
|
|
if (ref($extrargs)) {
|
|
|
|
@exargs=@$extrargs;
|
|
|
|
}
|
2010-11-07 06:33:53 +00:00
|
|
|
if (($#exargs==-1) or (($#exargs==0) and ($exargs[0] =~ /^\s*$/)) and (!$noderange and $command ne "lsslp")) {
|
2009-11-24 15:12:39 +00:00
|
|
|
$exargs[0] = "--help"; # force help if no args
|
|
|
|
}
|
|
|
|
|
2012-12-10 09:13:39 +00:00
|
|
|
# rflash: -p flag is to specify a directory, which will be parsed as a node range with regular expression
|
|
|
|
# stop the rflash command without noderange
|
|
|
|
# rflash -p /tmp/test --activate disruptive
|
|
|
|
# where the /tmp/test will be treated as noderange with regular expression
|
|
|
|
# this is a general issue for the xcatclient commands, if with a flag can be followed by directory
|
|
|
|
# however, rflash is the only one we can think of for now.
|
|
|
|
if(!$noderange and $command eq "rflash") {
|
|
|
|
$exargs[0] = "--help";
|
|
|
|
}
|
|
|
|
|
2009-11-24 15:12:39 +00:00
|
|
|
my $usage_string=xCAT::Usage->parseCommand($command, @exargs);
|
|
|
|
if ($usage_string) {
|
|
|
|
$callback->({data=>[$usage_string]});
|
|
|
|
$request = {};
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# Process request from xCat daemon
|
|
|
|
##########################################################################
|
|
|
|
sub process_request {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1;
|