From a46c4c529c95026c0de1142b95d57b54ecc722a5 Mon Sep 17 00:00:00 2001 From: zhanx Date: Tue, 4 Aug 2009 20:28:03 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/PPCconn.pm | 47 +++++++++++++++-------------- perl-xCAT/xCAT/Usage.pm | 20 ++++++------ xCAT-client/xCAT-client.spec | 6 ++-- xCAT-server/lib/perl/xCAT/PPC.pm | 18 +++++------ xCAT-server/lib/xcat/plugins/bpa.pm | 6 ++-- xCAT-server/lib/xcat/plugins/fsp.pm | 6 ++-- xCAT-server/lib/xcat/plugins/hmc.pm | 6 ++-- 7 files changed, 55 insertions(+), 54 deletions(-) diff --git a/perl-xCAT/xCAT/PPCconn.pm b/perl-xCAT/xCAT/PPCconn.pm index 85bf395f5..b1d694722 100644 --- a/perl-xCAT/xCAT/PPCconn.pm +++ b/perl-xCAT/xCAT/PPCconn.pm @@ -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; diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 3aff63363..c280f5b27 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -144,19 +144,19 @@ my %usage = ( "Usage: rflash [ -h|--help|-v|--version] rflash -p directory [--activate concurrent | disruptive][-V|--verbose] rflash [--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 = ( diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index 80178f077..a64f75c88 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -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 diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 5ced40aef..69dca264c 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -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; } diff --git a/xCAT-server/lib/xcat/plugins/bpa.pm b/xCAT-server/lib/xcat/plugins/bpa.pm index 439db08bf..d74501d9a 100644 --- a/xCAT-server/lib/xcat/plugins/bpa.pm +++ b/xCAT-server/lib/xcat/plugins/bpa.pm @@ -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' }; } diff --git a/xCAT-server/lib/xcat/plugins/fsp.pm b/xCAT-server/lib/xcat/plugins/fsp.pm index 82a272d29..2118b8de1 100644 --- a/xCAT-server/lib/xcat/plugins/fsp.pm +++ b/xCAT-server/lib/xcat/plugins/fsp.pm @@ -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' }; } diff --git a/xCAT-server/lib/xcat/plugins/hmc.pm b/xCAT-server/lib/xcat/plugins/hmc.pm index 1e3f45248..e4585065a 100644 --- a/xCAT-server/lib/xcat/plugins/hmc.pm +++ b/xCAT-server/lib/xcat/plugins/hmc.pm @@ -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' }; }