change the way of getting node type.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9738 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
036e8580fd
commit
061e99594b
@ -88,7 +88,7 @@ sub mkhwconn_parse_args
|
||||
##########################################
|
||||
my $nodes = $request->{node};
|
||||
my $ppctab = xCAT::Table->new( 'ppc' );
|
||||
my $nodetypetab = xCAT::Table->new( 'nodetype');
|
||||
#my $nodetypetab = xCAT::Table->new( 'nodetype');
|
||||
my $vpdtab = xCAT::Table->new( 'vpd');
|
||||
my @bpa_ctrled_nodes = ();
|
||||
my @no_type_nodes = ();
|
||||
@ -99,8 +99,9 @@ sub mkhwconn_parse_args
|
||||
##########################################
|
||||
if ( exists $opt{p} )
|
||||
{
|
||||
my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]);
|
||||
my $nodetype = $nodetype_hash->{nodetype};
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]);
|
||||
#my $nodetype = $nodetype_hash->{nodetype};
|
||||
my $nodetype = xCAT::DBobjUtils->getnodetype($opt{p});
|
||||
if( !defined($nodetype) ) {
|
||||
return(usage("Something wrong with the specified HMC (-p Option). The HMC type doesn't exist."));
|
||||
}
|
||||
@ -118,15 +119,16 @@ sub mkhwconn_parse_args
|
||||
my $node_parent = undef;
|
||||
my $nodetype = undef;
|
||||
my $node_hcp_nodetype = undef;
|
||||
my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]);
|
||||
if ( exists $opt{t} )
|
||||
{
|
||||
my $node_hcp_hash = $ppctab->getNodeAttribs( $node,[qw(hcp)]);
|
||||
if ( $node_hcp_hash->{hcp} )
|
||||
{
|
||||
my $node_hcp_nodetype_hash = $nodetypetab->getNodeAttribs($node_hcp_hash->{hcp},[qw(nodetype)]);
|
||||
$node_hcp_nodetype = $node_hcp_nodetype_hash->{nodetype};
|
||||
#my $node_hcp_nodetype_hash = $nodetypetab->getNodeAttribs($node_hcp_hash->{hcp},[qw(nodetype)]);
|
||||
#$node_hcp_nodetype = $node_hcp_nodetype_hash->{nodetype};
|
||||
$node_hcp_nodetype = xCAT::DBobjUtils->getnodetype($node_hcp_hash->{hcp});
|
||||
}
|
||||
if ( defined $hcp_nodetype )
|
||||
{
|
||||
@ -145,7 +147,8 @@ sub mkhwconn_parse_args
|
||||
}
|
||||
|
||||
}
|
||||
$nodetype = $nodetype_hash->{nodetype};
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = CAT::DBobjUtils->getnodetype($node);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype )
|
||||
{
|
||||
@ -227,7 +230,7 @@ sub mkhwconn_parse_args
|
||||
}
|
||||
|
||||
$ppctab->close();
|
||||
$nodetypetab->close();
|
||||
#$nodetypetab->close();
|
||||
$vpdtab->close();
|
||||
|
||||
$request->{method} = 'mkhwconn';
|
||||
@ -332,11 +335,11 @@ sub lshwconn_parse_args
|
||||
if ( scalar( @ARGV)) {
|
||||
return(usage( "No additional flag is support by this command" ));
|
||||
}
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
if (! $nodetypetab)
|
||||
{
|
||||
return( ["Failed to open table 'nodetype'.\n"]);
|
||||
}
|
||||
#my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
#if (! $nodetypetab)
|
||||
#{
|
||||
# return( ["Failed to open table 'nodetype'.\n"]);
|
||||
#}
|
||||
my $nodehmtab = xCAT::Table->new('nodehm');
|
||||
if (! $nodehmtab)
|
||||
{
|
||||
@ -346,35 +349,36 @@ sub lshwconn_parse_args
|
||||
my $nodetype;
|
||||
for my $node ( @{$request->{node}})
|
||||
{
|
||||
my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]);
|
||||
#my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]);
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $ent)
|
||||
{
|
||||
return( ["Failed to get node type for node $node.\n"]);
|
||||
}
|
||||
if ( ! $nodehm)
|
||||
#if ( ! $ent)
|
||||
#{
|
||||
# return( ["Failed to get node type for node $node.\n"]);
|
||||
#}
|
||||
my $ttype = xCAT::DBobjUtils->getnodetype($node);
|
||||
if ( ! $ttype)
|
||||
{
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
}
|
||||
if ( $ent->{nodetype} ne 'fsp' and $ent->{nodetype} ne 'cec'
|
||||
and $ent->{nodetype} ne 'bpa' and $ent->{nodetype} ne 'frame')
|
||||
if ( $ttype ne 'fsp' and $ttype ne 'cec'
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame')
|
||||
{
|
||||
return( ["Node type $ent->{nodetype} is not supported for this command in FSPAPI\n"]);
|
||||
return( ["Node type $ttype is not supported for this command in FSPAPI\n"]);
|
||||
}
|
||||
if ( ! $nodetype)
|
||||
{
|
||||
$nodetype = $ent->{nodetype};
|
||||
$nodetype = $ttype; #$ent->{nodetype};
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $nodetype ne $ent->{nodetype})
|
||||
if ( $nodetype ne $ttype) #$ent->{nodetype})
|
||||
{
|
||||
return( ["Cannot support multiple node types in this command line.\n"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nodetypetab->close();
|
||||
#$nodetypetab->close();
|
||||
$nodehmtab->close();
|
||||
|
||||
$request->{nodetype} = $nodetype;
|
||||
@ -441,8 +445,8 @@ sub rmhwconn_parse_args
|
||||
my $nodes = $request->{node};
|
||||
my $ppctab = xCAT::Table->new( 'ppc' );
|
||||
return( ["Failed to open table 'ppc'.\n"]) if ( ! $ppctab);
|
||||
my $nodetypetab = xCAT::Table->new( 'nodetype');
|
||||
return( ["Failed to open table 'nodetype'.\n"]) if ( ! $nodetypetab);
|
||||
#my $nodetypetab = xCAT::Table->new( 'nodetype');
|
||||
#return( ["Failed to open table 'nodetype'.\n"]) if ( ! $nodetypetab);
|
||||
my $vpdtab = xCAT::Table->new( 'vpd');
|
||||
return( ["Failed to open table 'vpd'.\n"]) if ( ! $vpdtab);
|
||||
my $nodehmtab = xCAT::Table->new('nodehm');
|
||||
@ -460,9 +464,10 @@ sub rmhwconn_parse_args
|
||||
|
||||
my $node_parent = undef;
|
||||
my $nodetype = undef;
|
||||
my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]);
|
||||
$nodetype = $nodetype_hash->{nodetype};
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype)
|
||||
{
|
||||
@ -497,7 +502,7 @@ sub rmhwconn_parse_args
|
||||
}
|
||||
|
||||
$ppctab->close();
|
||||
$nodetypetab->close();
|
||||
#$nodetypetab->close();
|
||||
$vpdtab->close();
|
||||
$nodehmtab->close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user