Fix defects:2831998 lsconn not working with -V --verbose flag; Change *conn commands to *hwconn
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3940 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -10,9 +10,9 @@ use xCAT::Usage;
 | 
			
		||||
# Globals
 | 
			
		||||
##############################################
 | 
			
		||||
my %method = (
 | 
			
		||||
    mkconn => \&mkconn_parse_args,
 | 
			
		||||
    lsconn => \&lsconn_parse_args,
 | 
			
		||||
    rmconn => \&rmconn_parse_args
 | 
			
		||||
    mkhwconn => \&mkhwconn_parse_args,
 | 
			
		||||
    lshwconn => \&lshwconn_parse_args,
 | 
			
		||||
    rmhwconn => \&rmhwconn_parse_args
 | 
			
		||||
);
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Parse the command line for options and operands
 | 
			
		||||
@@ -30,16 +30,16 @@ sub parse_args {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Parse arguments for mkconn
 | 
			
		||||
# Parse arguments for mkhwconn
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub mkconn_parse_args
 | 
			
		||||
sub mkhwconn_parse_args
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $args    = shift;
 | 
			
		||||
    my %opt = ();
 | 
			
		||||
 | 
			
		||||
    local *usage = sub {
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("mkconn");
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("mkhwconn");
 | 
			
		||||
        return( [ $_[0], $usage_string] );
 | 
			
		||||
    };
 | 
			
		||||
    #############################################
 | 
			
		||||
@@ -53,7 +53,7 @@ sub mkconn_parse_args
 | 
			
		||||
    $Getopt::Long::ignorecase = 0;
 | 
			
		||||
    Getopt::Long::Configure( "bundling" );
 | 
			
		||||
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose t p=s P=s) )) {
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose h|help t p=s P=s) )) {
 | 
			
		||||
        return( usage() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -128,7 +128,7 @@ sub mkconn_parse_args
 | 
			
		||||
    # Set HW type to 'hmc' anyway, so that this command will not going to 
 | 
			
		||||
    # PPCfsp.pm
 | 
			
		||||
    $request->{ 'hwtype'} = 'hmc';
 | 
			
		||||
    $request->{method} = 'mkconn';
 | 
			
		||||
    $request->{method} = 'mkhwconn';
 | 
			
		||||
    return( \%opt);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -173,16 +173,16 @@ sub getFrameMembers
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Parse arguments for lsconn
 | 
			
		||||
# Parse arguments for lshwconn
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub lsconn_parse_args
 | 
			
		||||
sub lshwconn_parse_args
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $args    = shift;
 | 
			
		||||
    my %opt = ();
 | 
			
		||||
 | 
			
		||||
    local *usage = sub {
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("lsconn");
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("lshwconn");
 | 
			
		||||
        return( [ $_[0], $usage_string] );
 | 
			
		||||
    };
 | 
			
		||||
#############################################
 | 
			
		||||
@@ -192,14 +192,15 @@ sub lsconn_parse_args
 | 
			
		||||
    $Getopt::Long::ignorecase = 0;
 | 
			
		||||
    Getopt::Long::Configure( "bundling" );
 | 
			
		||||
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose) )) {
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose h|help) )) {
 | 
			
		||||
        return( usage() );
 | 
			
		||||
    }
 | 
			
		||||
    return usage() if ( exists $opt{h});
 | 
			
		||||
 | 
			
		||||
    #############################################
 | 
			
		||||
    # Process command-line arguments
 | 
			
		||||
    #############################################
 | 
			
		||||
    if ( $args && scalar @$args) {
 | 
			
		||||
    if ( scalar( @ARGV)) {
 | 
			
		||||
        return(usage( "No additional flag is support by this command" ));
 | 
			
		||||
    }
 | 
			
		||||
    my $notypetab = xCAT::Table->new('nodetype');
 | 
			
		||||
@@ -237,21 +238,21 @@ sub lsconn_parse_args
 | 
			
		||||
    
 | 
			
		||||
    $request->{nodetype} = $nodetype;
 | 
			
		||||
 | 
			
		||||
    $request->{method} = 'lsconn';
 | 
			
		||||
    $request->{method} = 'lshwconn';
 | 
			
		||||
    return( \%opt);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Parse arguments for rmconn
 | 
			
		||||
# Parse arguments for rmhwconn
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub rmconn_parse_args
 | 
			
		||||
sub rmhwconn_parse_args
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $args    = shift;
 | 
			
		||||
    my %opt = ();
 | 
			
		||||
 | 
			
		||||
    local *usage = sub {
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("rmconn");
 | 
			
		||||
        my $usage_string = xCAT::Usage->getUsage("rmhwconn");
 | 
			
		||||
        return( [ $_[0], $usage_string] );
 | 
			
		||||
    };
 | 
			
		||||
#############################################
 | 
			
		||||
@@ -261,14 +262,14 @@ sub rmconn_parse_args
 | 
			
		||||
    $Getopt::Long::ignorecase = 0;
 | 
			
		||||
    Getopt::Long::Configure( "bundling" );
 | 
			
		||||
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose) )) {
 | 
			
		||||
    if ( !GetOptions( \%opt, qw(V|verbose h|help) )) {
 | 
			
		||||
        return( usage() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #############################################
 | 
			
		||||
    # Process command-line arguments
 | 
			
		||||
    #############################################
 | 
			
		||||
    if ( $args && scalar @$args) {
 | 
			
		||||
    if ( scalar (@ARGV)) {
 | 
			
		||||
        return(usage( "No additional flag is support by this command" ));
 | 
			
		||||
    }
 | 
			
		||||
    ##########################################
 | 
			
		||||
@@ -329,13 +330,13 @@ sub rmconn_parse_args
 | 
			
		||||
        my @all_nodes = xCAT::Utils::get_unique_members( @$nodes, @frame_members);
 | 
			
		||||
        $request->{node} = \@all_nodes;
 | 
			
		||||
    }
 | 
			
		||||
    $request->{method} = 'rmconn';
 | 
			
		||||
    $request->{method} = 'rmhwconn';
 | 
			
		||||
    return( \%opt);
 | 
			
		||||
}
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Create connection for CECs/BPAs
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub mkconn
 | 
			
		||||
sub mkhwconn
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $hash    = shift;
 | 
			
		||||
@@ -398,7 +399,7 @@ sub mkconn
 | 
			
		||||
##########################################################################
 | 
			
		||||
# List connection status for CECs/BPAs
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub lsconn
 | 
			
		||||
sub lshwconn
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $hash    = shift;
 | 
			
		||||
@@ -508,7 +509,7 @@ sub lsconn
 | 
			
		||||
##########################################################################
 | 
			
		||||
# Remove connection for CECs/BPAs to HMCs
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub rmconn
 | 
			
		||||
sub rmhwconn
 | 
			
		||||
{
 | 
			
		||||
    my $request = shift;
 | 
			
		||||
    my $hash    = shift;
 | 
			
		||||
 
 | 
			
		||||
@@ -144,19 +144,19 @@ my %usage = (
 | 
			
		||||
"Usage: rflash [ -h|--help|-v|--version]
 | 
			
		||||
	rflash <noderange> -p directory [--activate concurrent | disruptive][-V|--verbose] 
 | 
			
		||||
	rflash <noderange> [--commit | --recover] [-V|--verbose]",
 | 
			
		||||
    "mkconn" =>
 | 
			
		||||
    "mkhwconn" =>
 | 
			
		||||
"Usage:
 | 
			
		||||
    mkconn [-h|--help]
 | 
			
		||||
    mkconn noderange -t [--bind] [-V|--verbose]
 | 
			
		||||
    mkconn noderange -p single_hmc [-P fsp/bpa passwd] [-V|--verbose]",
 | 
			
		||||
    "rmconn" =>
 | 
			
		||||
    mkhwconn [-h|--help]
 | 
			
		||||
    mkhwconn noderange -t [--bind] [-V|--verbose]
 | 
			
		||||
    mkhwconn noderange -p single_hmc [-P fsp/bpa passwd] [-V|--verbose]",
 | 
			
		||||
    "rmhwconn" =>
 | 
			
		||||
"Usage:
 | 
			
		||||
    rmconn [-h|--help]
 | 
			
		||||
    rmconn noderange [-V|--verbose]",
 | 
			
		||||
    "lsconn" =>
 | 
			
		||||
    rmhwconn [-h|--help]
 | 
			
		||||
    rmhwconn noderange [-V|--verbose]",
 | 
			
		||||
    "lshwconn" =>
 | 
			
		||||
"Usage:
 | 
			
		||||
    lsconn [-h|--help]
 | 
			
		||||
    lsconn noderange [-V|--verbose]",
 | 
			
		||||
    lshwconn [-h|--help]
 | 
			
		||||
    lshwconn noderange [-V|--verbose]",
 | 
			
		||||
);
 | 
			
		||||
my $vers = xCAT::Utils->Version();
 | 
			
		||||
my %version = (
 | 
			
		||||
 
 | 
			
		||||
@@ -167,9 +167,9 @@ ln -sf ../bin/xcatDBcmds $RPM_BUILD_ROOT/%{prefix}/bin/rmdef
 | 
			
		||||
ln -sf ../bin/xcatDBcmds $RPM_BUILD_ROOT/%{prefix}/bin/xcat2nim
 | 
			
		||||
ln -sf ../bin/xdsh $RPM_BUILD_ROOT/%{prefix}/bin/xdcp
 | 
			
		||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/mknb
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/mkconn
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rmconn
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/lsconn
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/mkhwconn
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rmhwconn
 | 
			
		||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/lshwconn
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,9 +35,9 @@ my %modules = (
 | 
			
		||||
        reventlog => "xCAT::PPClog",
 | 
			
		||||
        rspconfig => "xCAT::PPCcfg",
 | 
			
		||||
        rflash => "xCAT::PPCrflash",
 | 
			
		||||
        mkconn    => "xCAT::PPCconn",
 | 
			
		||||
        rmconn    => "xCAT::PPCconn",
 | 
			
		||||
        lsconn    => "xCAT::PPCconn"
 | 
			
		||||
        mkhwconn    => "xCAT::PPCconn",
 | 
			
		||||
        rmhwconn    => "xCAT::PPCconn",
 | 
			
		||||
        lshwconn    => "xCAT::PPCconn"
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
##########################################
 | 
			
		||||
@@ -589,9 +589,9 @@ sub preprocess_nodes {
 | 
			
		||||
    #   Direct-attached FSP 
 | 
			
		||||
    ########################################
 | 
			
		||||
    if (( $request->{command} =~ /^(rscan|rspconfig)$/ ) or
 | 
			
		||||
#        (( $request->{hwtype} eq "fsp" or $request->{hwtype} eq "bpa" ) and ( $request->{command} ne "mkconn")) or
 | 
			
		||||
#        (( $request->{hwtype} eq "fsp" or $request->{hwtype} eq "bpa" ) and ( $request->{command} ne "mkhwconn")) or
 | 
			
		||||
        ($request->{hwtype} eq "fsp" or $request->{hwtype} eq "bpa" ) or
 | 
			
		||||
        ($request->{command} eq 'lsconn' and $request->{nodetype} eq 'hmc')
 | 
			
		||||
        ($request->{command} eq 'lshwconn' and $request->{nodetype} eq 'hmc')
 | 
			
		||||
) {
 | 
			
		||||
        my $result = resolve_hcp( $request, $noderange );
 | 
			
		||||
        return( $result );
 | 
			
		||||
@@ -637,9 +637,9 @@ sub preprocess_nodes {
 | 
			
		||||
        my $mtms = @$d[2];
 | 
			
		||||
 
 | 
			
		||||
        ######################################
 | 
			
		||||
        # Special case for mkconn
 | 
			
		||||
        # Special case for mkhwconn
 | 
			
		||||
        ######################################
 | 
			
		||||
        if ( $request->{command} eq "mkconn" and 
 | 
			
		||||
        if ( $request->{command} eq "mkhwconn" and 
 | 
			
		||||
              exists $request->{opt}->{p})
 | 
			
		||||
        {
 | 
			
		||||
            $nodehash{ $request->{opt}->{p}}{$mtms}{$node} = $d;
 | 
			
		||||
@@ -1350,12 +1350,12 @@ sub process_request {
 | 
			
		||||
#    $request->{hwtype}  = $package;
 | 
			
		||||
    $request->{callback}= $callback;
 | 
			
		||||
    #########################
 | 
			
		||||
    #This is a special case for rspconfig and mkconn, 
 | 
			
		||||
    #This is a special case for rspconfig and mkhwconn, 
 | 
			
		||||
    #we shouldn't set hwtype as$package. and reserved for other commands.
 | 
			
		||||
    #probably for all HW ctrl commands it still true?
 | 
			
		||||
    #########################
 | 
			
		||||
    if($request->{command} ne "rspconfig" and 
 | 
			
		||||
        $request->{command} ne "mkconn") {
 | 
			
		||||
        $request->{command} ne "mkhwconn") {
 | 
			
		||||
        $request->{hwtype}  = $package;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,9 +11,9 @@ use xCAT::PPC;
 | 
			
		||||
sub handled_commands {
 | 
			
		||||
  return {
 | 
			
		||||
      rspconfig => 'nodehm:mgt',
 | 
			
		||||
      mkconn    => 'nodehm:mgt',
 | 
			
		||||
      rmconn    => 'nodehm:mgt',
 | 
			
		||||
      chconn    => 'nodehm:mgt'
 | 
			
		||||
      mkhwconn    => 'nodehm:mgt',
 | 
			
		||||
      rmhwconn    => 'nodehm:mgt',
 | 
			
		||||
      lshwconn    => 'nodehm:mgt'
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,9 +13,9 @@ sub handled_commands {
 | 
			
		||||
      rpower    => 'nodehm:power,mgt',
 | 
			
		||||
      reventlog => 'nodehm:mgt',
 | 
			
		||||
      rspconfig => 'nodehm:mgt',
 | 
			
		||||
      mkconn    => 'nodehm:mgt',
 | 
			
		||||
      rmconn    => 'nodehm:mgt',
 | 
			
		||||
      chconn    => 'nodehm:mgt'
 | 
			
		||||
      mkhwconn    => 'nodehm:mgt',
 | 
			
		||||
      rmhwconn    => 'nodehm:mgt',
 | 
			
		||||
      lshwconn    => 'nodehm:mgt'
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,9 +22,9 @@ sub handled_commands {
 | 
			
		||||
      rnetboot  => 'nodehm:mgt',
 | 
			
		||||
      rspconfig => 'nodehm:mgt',
 | 
			
		||||
      rflash    => 'nodehm:mgt',
 | 
			
		||||
      mkconn    => 'nodehm:mgt',
 | 
			
		||||
      rmconn    => 'nodehm:mgt',
 | 
			
		||||
      lsconn    => 'nodehm:mgt'
 | 
			
		||||
      mkhwconn    => 'nodehm:mgt',
 | 
			
		||||
      rmhwconn    => 'nodehm:mgt',
 | 
			
		||||
      lshwconn    => 'nodehm:mgt'
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user