-Speed up nodestat
-Additionally, provide list of all known detected states rather than making value judgements as to what is most important git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2792 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
0acd496083
commit
b5dd66ff03
@ -130,12 +130,66 @@ sub preprocess_request
|
||||
return \@requests;
|
||||
}
|
||||
|
||||
sub interrogate_node { #Meant to run against confirmed up nodes
|
||||
my $node=shift;
|
||||
my $doreq=shift;
|
||||
my $status = "";
|
||||
if (nodesockopen($node,15002)) {
|
||||
$status.="pbs,"
|
||||
}
|
||||
if (nodesockopen($node,8002)) {
|
||||
$status.="xend,"
|
||||
}
|
||||
if (nodesockopen($node,22)) {
|
||||
$status.="sshd,"
|
||||
}
|
||||
$status =~ s/,$//;
|
||||
if ($status) {
|
||||
return $status;
|
||||
}
|
||||
if ($status = installer_query($node)) {
|
||||
return $status;
|
||||
} else { #pingable, but no *clue* as to what the state may be
|
||||
$doreq->({command=>['nodeset'],
|
||||
node=>[$node],
|
||||
arg=>['stat']},
|
||||
\&getstat);
|
||||
return 'ping '.$stat;
|
||||
}
|
||||
}
|
||||
|
||||
sub process_request {
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $doreq = shift;
|
||||
my @nodes = @{$request->{node}};
|
||||
my %unknownnodes;
|
||||
foreach (@nodes) {
|
||||
$unknownnodes{$_}=1;
|
||||
}
|
||||
my $node;
|
||||
my $fping;
|
||||
open($fping,"fping ".join(' ',@nodes). " 2> /dev/null|") or die("Can't start fping: $!");
|
||||
while (<$fping>) {
|
||||
my %rsp;
|
||||
my $node=$_;
|
||||
$node =~ s/ .*//;
|
||||
chomp $node;
|
||||
if (/ is alive/) {
|
||||
$rsp{name}=[$node];
|
||||
$rsp{data} = [ interrogate_node($node,$doreq) ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
} elsif (/is unreachable/) {
|
||||
$rsp{name}=[$node];
|
||||
$rsp{data} = [ 'noping' ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
} elsif (/ address not found/) {
|
||||
$rsp{name}=[$node];
|
||||
$rsp{data} = [ 'nosuchhost' ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
}
|
||||
}
|
||||
@nodes=();
|
||||
foreach $node (@nodes) {
|
||||
my %rsp;
|
||||
my $text="";
|
||||
@ -149,6 +203,10 @@ sub process_request {
|
||||
$rsp{data} = [ 'pbs' ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
next;
|
||||
} elsif (nodesockopen($node,8002)) {
|
||||
$rsp{data} = [ 'xend' ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
next;
|
||||
} elsif (nodesockopen($node,22)) {
|
||||
$rsp{data} = [ 'sshd' ];
|
||||
$callback->({node=>[\%rsp]});
|
||||
|
Loading…
Reference in New Issue
Block a user