From f98359ae333aa2176f5d2e310c2605222791f93b Mon Sep 17 00:00:00 2001 From: jjhua Date: Wed, 4 Aug 2010 07:06:48 +0000 Subject: [PATCH] rscan for multiple hardware control points git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6969 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/FSPUtils.pm | 8 ++++---- perl-xCAT/xCAT/FSPpower.pm | 6 +----- xCAT-server/lib/perl/xCAT/PPC.pm | 32 +++++++++++++++++++------------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/perl-xCAT/xCAT/FSPUtils.pm b/perl-xCAT/xCAT/FSPUtils.pm index 9cff2d8ce..65a32de0b 100644 --- a/perl-xCAT/xCAT/FSPUtils.pm +++ b/perl-xCAT/xCAT/FSPUtils.pm @@ -230,18 +230,18 @@ sub fsp_state_action { return( [$Rc,@res] ); } -sub getTypeOfHcp +sub getTypeOfNode { my $class = shift; - my $hcp = shift; + my $node = shift; my $nodetypetab = xCAT::Table->new( 'nodetype'); xCAT::MsgUtils->message('E', "Failed to open table 'nodetype'.") if ( ! $nodetypetab); - my $nodetype_hash = $nodetypetab->getNodeAttribs( $hcp,[qw(nodetype)]); + my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $nodetype = $nodetype_hash->{nodetype}; if ( !$nodetype) { - xCAT::MsgUtils->message('E', "Not found the $hcp\'s nodetype"); + xCAT::MsgUtils->message('E', "Not found the $node\'s nodetype"); return undef; } return $nodetype; diff --git a/perl-xCAT/xCAT/FSPpower.pm b/perl-xCAT/xCAT/FSPpower.pm index 89e401b22..4f1333d94 100644 --- a/perl-xCAT/xCAT/FSPpower.pm +++ b/perl-xCAT/xCAT/FSPpower.pm @@ -4,10 +4,6 @@ package xCAT::FSPpower; use strict; #use Getopt::Long; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); -use xCAT::Usage; -use xCAT::MsgUtils; -use Data::Dumper; -use xCAT::DBobjUtils; use xCAT::PPCpower; use xCAT::FSPUtils; ########################################################################## @@ -387,7 +383,7 @@ sub state1 { if($$d[4] =~ /^fsp$/ || $$d[4] =~ /^bpa$/) { $action = "cec_state"; } - my $stat = xCAT::Utils::fsp_api_action ($node_name, $d, $action); + my $stat = xCAT::FSPUtils::fsp_api_action ($node_name, $d, $action); my $Rc = @$stat[2]; my $data = @$stat[1]; my $type = @$d[4]; diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index f34c91c15..669cacabc 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -1726,7 +1726,7 @@ sub process_request { }#end of if #print "thishcp:$thishcp\n"; #get the nodetype of hcp: - my $thishcp_type = xCAT::FSPUtils->getTypeOfHcp($thishcp, $callback); + my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($thishcp); if(!defined($thishcp_type)) { $request = {}; next; @@ -1952,18 +1952,24 @@ sub getHCPsOfNodes my %hcps = (); #get hcp from ppc. foreach my $node( @$nodes) { - my $ppctab = xCAT::Table->new( 'ppc'); - unless($ppctab) { - $callback->({data=>["Cannot open ppc table"]}); - return undef; - } - #xCAT::MsgUtils->message('E', "Failed to open table 'ppc'.") if ( ! $ppctab); - my $hcp_hash = $ppctab->getNodeAttribs( $node,[qw(hcp)]); - my $hcp = $hcp_hash->{hcp}; - if ( !$hcp) { - #xCAT::MsgUtils->message('E', "Not found the hcp of $node"); - $callback->({data=>["Not found the hcp of $node"]}); - return undef; + my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($node); + if( $thishcp_type eq "hmc") { + $hcps{$node}{hcp} = [$node]; + $hcps{$node}{num} = 1; + } else { + my $ppctab = xCAT::Table->new( 'ppc'); + unless($ppctab) { + $callback->({data=>["Cannot open ppc table"]}); + return undef; + } + #xCAT::MsgUtils->message('E', "Failed to open table 'ppc'.") if ( ! $ppctab); + my $hcp_hash = $ppctab->getNodeAttribs( $node,[qw(hcp)]); + my $hcp = $hcp_hash->{hcp}; + if ( !$hcp) { + #xCAT::MsgUtils->message('E', "Not found the hcp of $node"); + $callback->({data=>["Not found the hcp of $node"]}); + return undef; + } } #print "hcp:\n"; #print Dumper($hcp);