diff --git a/perl-xCAT/xCAT/FSPUtils.pm b/perl-xCAT/xCAT/FSPUtils.pm index 619571d77..0c858873f 100644 --- a/perl-xCAT/xCAT/FSPUtils.pm +++ b/perl-xCAT/xCAT/FSPUtils.pm @@ -225,14 +225,23 @@ sub getTypeOfNode { my $class = shift; my $node = shift; + my $callback = shift; my $nodetypetab = xCAT::Table->new( 'nodetype'); - xCAT::MsgUtils->message('E', "Failed to open table 'nodetype'.") if ( ! $nodetypetab); + if (!$nodetypetab) { + my $rsp; + $rsp->{errorcode}->[0] = [1]; + $rsp->{data}->[0]= "Failed to open table 'nodetype'"; + xCAT::MsgUtils->message('E', $rsp, $callback); + } my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $nodetype = $nodetype_hash->{nodetype}; if ( !$nodetype) { - xCAT::MsgUtils->message('E', "Not found the $node\'s nodetype"); + my $rsp; + $rsp->{errorcode}->[0] = [1]; + $rsp->{data}->[0]= "Not found the $node\'s nodetype"; + xCAT::MsgUtils->message('E', $rsp, $callback); return undef; } return $nodetype; diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 8d9532fbf..1e6e81425 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -1733,7 +1733,7 @@ sub process_request { }#end of if #print "thishcp:$thishcp\n"; #get the nodetype of hcp: - my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($thishcp); + my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($thishcp,$callback); if(!defined($thishcp_type)) { $request = {}; next; @@ -1966,7 +1966,7 @@ sub getHCPsOfNodes my %hcps = (); #get hcp from ppc. foreach my $node( @$nodes) { - my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($node); + my $thishcp_type = xCAT::FSPUtils->getTypeOfNode($node, $callback); if( $thishcp_type eq "hmc") { $hcps{$node}{hcp} = [$node]; $hcps{$node}{num} = 1;