From c0aa4c2a24ba5c7f7eb4fc18e12d0db51cfce0ea Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 12 Oct 2010 20:44:45 +0000 Subject: [PATCH] bug fix, extra line like XXXXXYYYYYZZZ was printed out for noping nodes git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7826 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/nodestat.pm | 46 +++++++++++++----------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index 3177fcab5..c422cff82 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -550,6 +550,7 @@ sub process_request_nmap { } } $currnode=$tmpnode; + my $nip; if ($nip = xCAT::NetworkUtils->getipaddr($currnode)) { #reverse lookup may not resemble the nodename, key by ip if ($nodebyip{$nip}) { @@ -584,25 +585,29 @@ sub process_request_nmap { } } } - } - my $status = join ',',sort keys %states ; - my $appsd=""; - foreach my $portnum(keys %portservices) { - my $app_t=$portservices{$portnum}; - if ($states{$app_t}) {$appsd .= $app_t . "=up,";} - else {$appsd .= $app_t . "=down,";} - } - $appsd =~ s/,$//; + } - if ($status or ($installquerypossible and $status = installer_query($currnode))) { #pingable, but no *clue* as to what the state may be - $ret->{$currnode}->{'status'}="ping"; - $ret->{$currnode}->{'appstatus'}=$status; - $ret->{$currnode}->{'appsd'}=$appsd; - $currnode=""; - %states=(); - } else { - push @nodesetnodes,$currnode; #Aggregate call to nodeset - } + if ($currnode) { + my $status = join ',',sort keys %states ; + my $appsd=""; + foreach my $portnum(keys %portservices) { + my $app_t=$portservices{$portnum}; + if ($states{$app_t}) {$appsd .= $app_t . "=up,";} + else {$appsd .= $app_t . "=down,";} + } + $appsd =~ s/,$//; + + if ($status or ($installquerypossible and $status = installer_query($currnode))) { #pingable, but no *clue* as to what the state may be + $ret->{$currnode}->{'status'}="ping"; + $ret->{$currnode}->{'appstatus'}=$status; + $ret->{$currnode}->{'appsd'}=$appsd; + $currnode=""; + %states=(); + } else { + push @nodesetnodes,$currnode; #Aggregate call to nodeset + } + } + if (@nodesetnodes) { $doreq->({command=>['nodeset'], node=>\@nodesetnodes, @@ -763,7 +768,7 @@ sub process_request { my $separator="XXXXXYYYYYZZZZZ"; if ($command eq "nodestat_internal") { - + #if ( -x '/usr/bin/nmap' ) { # my %portservices = ( # '22' => 'sshd', @@ -854,7 +859,6 @@ sub process_request { } } } - #nodestat_internal command the output, nodestat command will collect it foreach my $node1 (sort keys(%$status)) { my %rsp; @@ -878,7 +882,7 @@ sub process_request { my $power=$request->{'power'}->[0]; foreach my $tmpdata (@$ret) { if ($tmpdata =~ /([^:]+): (.*)$separator(.*)$separator(.*)/) { - # print "node=$1, status=$2, appstatus=$3, appsd=$4\n"; + #print "node=$1, status=$2, appstatus=$3, appsd=$4\n"; $status->{$1}->{'status'}=$2; $status->{$1}->{'appstatus'}=$3; $status->{$1}->{'appsd'}=$4;