Use option '-D' of getmacs to determinate the operation mode of a pblade, -D for DFM, else for CMM

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11485 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao 2012-02-06 09:30:08 +00:00
parent 0bfa217540
commit 706b89520f
2 changed files with 58 additions and 10 deletions

View File

@ -3528,14 +3528,22 @@ sub preprocess_request {
#parse the arguments for commands
if ($command eq "getmacs") {
foreach my $arg (@exargs) {
if (defined($arg) && $arg !~ /^-V|--verbose|-d|--arp$/) {
$usage_string="Error arguments\n";
$usage_string .=xCAT::Usage->getUsage($command);
$callback->({data=>$usage_string});
$request = {};
return;
my (@mpnodes, @fspnodes);
filter_nodes($request, \@mpnodes, \@fspnodes);
if (@mpnodes) {
$noderange = \@mpnodes;
foreach my $arg (@exargs) {
if (defined($arg) && $arg !~ /^-V|--verbose|-d|--arp$/) {
$usage_string= ":Error arguments\n";
$usage_string .=xCAT::Usage->getUsage($command);
$callback->({data=>$usage_string});
$request = {};
return;
}
}
} else {
$request = {};
return;
}
} elsif ($command eq "renergy") {
if (! @exargs) {
@ -3706,12 +3714,28 @@ sub filter_nodes{
push @{$mpnodes}, @mp;
push @{$fspnodes}, @commonfsp;
## TRACE_LINE print "Nodes filter: mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n";
if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) {
push @{$mpnodes}, @ngpfsp;
} elsif($cmd eq "getmacs") {
if (@args && (grep /^-D$/,@args)) {
@mp = ();
foreach (@{$mpnodes}) {
if (defined($ppctabhash->{$_}->[0]->{'parent'})) {
push @{$fspnodes}, $_;
} else {
push @mp, $_;
}
}
push @{$fspnodes}, @ngpfsp;
@{$mpnodes} = ();;
push @{$mpnodes}, @mp;
} else {
push @{$mpnodes}, @ngpfsp;
}
} else {
push @{$fspnodes}, @ngpfsp;
}
## TRACE_LINE print "Nodes filter: mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n";
return 0;
}

View File

@ -84,7 +84,16 @@ sub preprocess_request {
return [];
}
}
if ($arg1->{command}->[0] eq "getmacs") {
my (@mpnodes, @fspnodes);
filter_nodes($arg1, \@mpnodes, \@fspnodes);
if (@fspnodes) {
$arg1->{noderange} = \@fspnodes;
} else {
return [];
}
}
xCAT::PPC::preprocess_request(__PACKAGE__,@_);
}
@ -160,10 +169,25 @@ sub filter_nodes{
push @{$fspnodes}, @commonfsp;
if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) {
push @{$mpnodes}, @ngpfsp;
} elsif($cmd eq "getmacs") {
if (@args && (grep /^-D$/,@args)) {
@mp = ();
foreach (@{$mpnodes}) {
if (defined($ppctabhash->{$_}->[0]->{'parent'})) {
push @{$fspnodes}, $_;
} else {
push @mp, $_;
}
}
push @{$fspnodes}, @ngpfsp;
@{$mpnodes} = ();
push @{$mpnodes}, @mp;
} else {
push @{$mpnodes}, @ngpfsp;
}
} else {
push @{$fspnodes}, @ngpfsp;
}
return 0;
}
##########################################################################