Tweak extnoderange function to be consistent with other commands, export it as client callable method

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2238 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-09-26 22:57:55 +00:00
parent 8d9567ff2b
commit e8f67622e6
2 changed files with 13 additions and 3 deletions

View File

@ -222,11 +222,11 @@ sub extnoderange { #An extended noderange function. Needed as the more straight
}
my $return;
$retaincache=1;
$return->{nodes}=[noderange($range,$verify)];
$return->{node}=[noderange($range,$verify)];
if ($namedopts->{intersectinggroups}) {
my %grouphash=();
my $nlent;
foreach (@{$return->{nodes}}) {
foreach (@{$return->{node}}) {
$nlent=$nodelist->getNodeAttribs($_,['groups']);
if ($nlent and $nlent->{groups}) {
foreach (split /,/,$nlent->{groups}) {

View File

@ -594,7 +594,7 @@ sub plugin_command {
my $sock = shift;
my $callback = shift;
my %handler_hash;
use xCAT::NodeRange;
use xCAT::NodeRange qw/extnoderange nodesmissed noderange/;
$Main::resps={};
my @nodes;
if ($req->{node}) {
@ -1101,6 +1101,16 @@ sub service_connection {
}
print $sock XMLout(\%resp,RootName => 'xcatresponse',NoAttr=>1);
next;
} elsif ($req->{command}->[0] eq "extnoderange" and $req->{noderange}) { #This is intended for the UIs to build trees
#as this would be part of a highly dynamic construct, it has a shortcut here to minimize server load
my $subgroups=0;
if ($req->{arg} and grep /subgroups/,@{$req->{arg}}) {
$subgroups=1;
}
my %resp=%{extnoderange($req->{noderange}->[0],{intersectinggroups=>$subgroups})};
$resp{serverdone}={};
print $sock XMLout(\%resp,RootName => 'xcatresponse',NoAttr=>1);
next;
} else {
my %resp=(error=>"Unsupported request");
$resp{serverdone} = {};