Fixed one issue switching between direct attach and hmc connection for mkhwconn

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5483 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2010-03-16 12:35:25 +00:00
parent ec488a3686
commit d37942b374
2 changed files with 47 additions and 9 deletions

View File

@ -70,6 +70,7 @@ sub mkhwconn_parse_args
return( usage('Flags -P can only be used when flag -p is specified.'));
}
##########################################
# Check if CECs are controlled by a frame
##########################################
@ -80,17 +81,58 @@ sub mkhwconn_parse_args
my @bpa_ctrled_nodes = ();
my @no_type_nodes = ();
my @frame_members = ();
###########################################
# mgt=fsp/bpa for PPCconn.pm
##########################################
if ( exists $opt{p} )
{
my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]);
my $nodetype = $nodetype_hash->{nodetype};
if ( $nodetype eq 'hmc' )
{
$request->{ 'hwtype'} = 'hmc';
}
}
if ( $ppctab)
{
my $hcp_nodetype = undef;
for my $node ( @$nodes)
{
my $node_parent = undef;
my $nodetype = undef;
my $node_hcp_nodetype = undef;
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};
}
if ( defined $hcp_nodetype )
{
if ( $hcp_nodetype ne $node_hcp_nodetype )
{
return( usage("Nodetype for all the nodes' hcp must be the same.") );
}
}
else
{
$hcp_nodetype = $node_hcp_nodetype;
if ( $hcp_nodetype eq 'hmc' )
{
$request->{ 'hwtype'} = 'hmc';
}
}
}
$nodetype = $nodetype_hash->{nodetype};
$node_parent = $node_parent_hash->{parent};
if ( !$nodetype)
if ( !$nodetype )
{
push @no_type_nodes, $node;
next;
@ -108,6 +150,7 @@ sub mkhwconn_parse_args
my $my_frame_bpa_cec = getFrameMembers( $node, $vpdtab, $ppctab);
push @frame_members, @$my_frame_bpa_cec;
}
}
}

View File

@ -130,6 +130,7 @@ sub mkhwconn_parse_args
# Set HW type to 'hmc' anyway, so that this command will not going to
# PPCfsp.pm
$request->{ 'hwtype'} = 'hmc';
$request->{hcp} = 'hmc';
$request->{method} = 'mkhwconn';
return( \%opt);
}
@ -390,16 +391,10 @@ sub mkhwconn
############################
# Get IP address
############################
my $hosttab = xCAT::Table->new( 'hosts' );
my $node_ip = undef;
if ( $hosttab)
{
my $node_ip_hash = $hosttab->getNodeAttribs( $node_name,[qw(ip)]);
$node_ip = $node_ip_hash->{ip};
}
my $node_ip = xCAT::Utils::getNodeIPaddress( $node_name );
if (!$node_ip)
{
push @value, [$node_name, $node_ip, $Rc];
push @value, [$node_name, "Cannot get IP address. Please check table 'hosts' or name resolution", 1];
next;
}
my ( undef,undef,$mtms,undef,$type) = @$d;