fix bug 3513522: provide more detailed information for 'conn' command
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12141 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
60867d1ce9
commit
c6178a5a94
@ -92,6 +92,7 @@ sub mkhwconn_parse_args
|
||||
my $vpdtab = xCAT::Table->new( 'vpd');
|
||||
my @bpa_ctrled_nodes = ();
|
||||
my @no_type_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
my @frame_members = ();
|
||||
|
||||
###########################################
|
||||
@ -159,7 +160,8 @@ sub mkhwconn_parse_args
|
||||
{
|
||||
unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc|blade)$/)
|
||||
{
|
||||
return ( usage("Node type is incorrect. \n"));
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,9 +190,12 @@ sub mkhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
return ( usage("Incorrect nodetype for nodes(s): $tmp_nodelist. Please modify first and try again.\n"));
|
||||
}
|
||||
|
||||
#if (scalar(@bpa_ctrled_nodes))
|
||||
#{
|
||||
# my $tmp_nodelist = join ',', @bpa_ctrled_nodes;
|
||||
@ -354,24 +359,30 @@ sub lshwconn_parse_args
|
||||
}
|
||||
|
||||
my $nodetype;
|
||||
my @no_typenodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype(\@{$request->{node}}, "ppc");
|
||||
for my $node ( @{$request->{node}})
|
||||
{
|
||||
#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"]);
|
||||
#}
|
||||
my $ttype = $$typehash{$node};
|
||||
if ( ! $ttype)
|
||||
if ( ! $nodehm)
|
||||
{
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
}
|
||||
my $ttype = $$typehash{$node};
|
||||
if ( !$ttype)
|
||||
{
|
||||
push @no_typenodes, $node;
|
||||
next;
|
||||
}
|
||||
if ( $ttype ne 'fsp' and $ttype ne 'cec'
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame' and $ttype ne 'blade')
|
||||
{
|
||||
return( ["Node type $ttype is not supported for this command in FSPAPI\n"]);
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
if ( ! $nodetype)
|
||||
{
|
||||
@ -385,7 +396,19 @@ sub lshwconn_parse_args
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@no_typenodes)) {
|
||||
my $tmp_nodelist = join ',', @no_typenodes;
|
||||
return ( ["Attribute nodetype.nodetype cannot be found for node(s): $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
|
||||
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command in FSPAPI.\n"]);
|
||||
}
|
||||
#$nodetypetab->close();
|
||||
$nodehmtab->close();
|
||||
|
||||
@ -461,6 +484,7 @@ sub rmhwconn_parse_args
|
||||
return( ["Failed to open table 'nodehm'.\n"]) if (! $nodehmtab);
|
||||
my @bpa_ctrled_nodes = ();
|
||||
my @no_type_nodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @frame_members = ();
|
||||
my $nodetype_hash = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
for my $node ( @$nodes)
|
||||
@ -468,7 +492,8 @@ sub rmhwconn_parse_args
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $nodehm)
|
||||
{
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
}
|
||||
|
||||
my $node_parent = undef;
|
||||
@ -505,9 +530,12 @@ sub rmhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
|
||||
$ppctab->close();
|
||||
#$nodetypetab->close();
|
||||
$vpdtab->close();
|
||||
|
@ -90,13 +90,14 @@ sub mkhwconn_parse_args
|
||||
my @frame_members = ();
|
||||
if ( $ppctab)
|
||||
{
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
for my $node ( @$nodes)
|
||||
{
|
||||
my $node_parent = undef;
|
||||
my $nodetype = undef;
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]);
|
||||
$nodetype = $$typehash{$node};
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype )
|
||||
{
|
||||
@ -159,7 +160,7 @@ sub mkhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again."));
|
||||
}
|
||||
|
||||
if (scalar(@bpa_ctrled_nodes))
|
||||
@ -285,6 +286,9 @@ sub lshwconn_parse_args
|
||||
}
|
||||
|
||||
my $nodetype;
|
||||
my @no_type_nodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
for my $node ( @{$request->{node}})
|
||||
{
|
||||
#my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]);
|
||||
@ -292,11 +296,13 @@ sub lshwconn_parse_args
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $ttype)
|
||||
{
|
||||
return( ["Failed to get node type for node $node.\n"]);
|
||||
push @no_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
if ( ! $nodehm)
|
||||
{
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
}
|
||||
elsif ( $nodehm->{mgt} ne 'hmc')
|
||||
{
|
||||
@ -306,7 +312,8 @@ sub lshwconn_parse_args
|
||||
and $ttype ne 'fsp' and $ttype ne 'cec'
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame')
|
||||
{
|
||||
return( ["Node type $ttype is not supported for this command.\n"]);
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
if ( ! $nodetype)
|
||||
{
|
||||
@ -320,7 +327,19 @@ sub lshwconn_parse_args
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@no_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return( ["Failed to get node type for node(s) $tmp_nodelist. Please define first and try again\n"]);
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
|
||||
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command.\n"]);
|
||||
}
|
||||
$request->{nodetype} = $nodetype;
|
||||
|
||||
$request->{method} = 'lshwconn';
|
||||
@ -379,6 +398,7 @@ sub rmhwconn_parse_args
|
||||
my $newtype = xCAT::DBobjUtils::getnodetype($node);
|
||||
unless ($newtype) {
|
||||
push @no_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($newtype =~ /^(fsp|bpa)$/ )
|
||||
@ -422,7 +442,7 @@ sub rmhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
}
|
||||
|
||||
if (scalar(@bpa_ctrled_nodes))
|
||||
|
Loading…
Reference in New Issue
Block a user