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);