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
This commit is contained in:
jjhua 2010-08-04 07:06:48 +00:00
parent 59101e8dab
commit f98359ae33
3 changed files with 24 additions and 22 deletions

View File

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

View File

@ -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];

View File

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