From b60c007f274a06612fde896ec5d80f01b84127fa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 1 Feb 2017 13:05:19 -0500 Subject: [PATCH] Clean up commented code that is useless in the console files --- xCAT-server/share/xcat/cons/blade | 41 ------ xCAT-server/share/xcat/cons/fsp | 197 -------------------------- xCAT-server/share/xcat/cons/hmc | 199 +-------------------------- xCAT-server/share/xcat/cons/hpblade | 38 ----- xCAT-server/share/xcat/cons/ipmi | 26 +--- xCAT-server/share/xcat/cons/ivm | 190 ------------------------- xCAT-server/share/xcat/cons/kvm | 17 --- xCAT-server/share/xcat/cons/multiple | 5 - xCAT-server/share/xcat/cons/xen | 19 --- 9 files changed, 3 insertions(+), 729 deletions(-) diff --git a/xCAT-server/share/xcat/cons/blade b/xCAT-server/share/xcat/cons/blade index 66e50dfbc..cb4bb08d5 100755 --- a/xCAT-server/share/xcat/cons/blade +++ b/xCAT-server/share/xcat/cons/blade @@ -32,57 +32,19 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd use lib "$::XCATROOT/lib/perl"; require xCAT::Client; - -#require xCAT::Table; -#require xCAT::Utils; require File::Basename; import File::Basename; my $scriptname = $0; -#$mptab = xCAT::Table->new('mp'); -#unless ($mptab) { -#sleep 5; #Try not to overwhelm logfiles... -# die "mp table must be configured"; -#} -#$mpatab = xCAT::Table->new('mpa'); -#$passtab = xCAT::Table->new('passwd'); - my $username = "USERID"; my $passsword = "PASSW0RD"; my $mm; my $slot; -#my $dba; -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>blade},qw(username password)); -# if ($dba->{username}) { -# $username = $dba->{username}; -# } -# if ($dba->{password}) { -# $password = $dba->{password}; -# } -#} - -#$dba = $mptab->getNodeAttribs($ARGV[0],[qw(mpa id)]); -#$mm = $dba->{mpa}; -#$slot = $dba->{id}; -#if ($mpatab) { -# ($dba) = $mpatab->getAttribs({mpa=>$mm},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} -#xCAT::Utils::close_all_dbhs; -#sleep 5; #Slow start, I know, but with exec, can't return sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -117,9 +79,6 @@ while ($solstatus !~ /SOL Session: Ready/ and $solstatus !~ /SOL Session: Active } exec "ssh -t $username" . "@" . "$mm console -o -T blade[$slot]"; -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - #SECURITY: In this case, the authentication is expected to be done using the script user's ssh keys. As such, #this script does not receive any particularly sensitive data from the xCAT server. diff --git a/xCAT-server/share/xcat/cons/fsp b/xCAT-server/share/xcat/cons/fsp index b2030b127..3abd0b46e 100755 --- a/xCAT-server/share/xcat/cons/fsp +++ b/xCAT-server/share/xcat/cons/fsp @@ -32,24 +32,14 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); use lib "$::XCATROOT/lib/perl"; require xCAT::Client; require xCAT::Utils; use strict; - -#use Getopt::Long; -#use xCAT::Table; -#use xCAT::PPCdb; use Expect; -#use xCAT::DBobjUtils; -#use Data::Dumper; require File::Basename; import File::Basename; my $scriptname = $0; @@ -63,108 +53,6 @@ my $ips; my $id; my $hwtype; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { - -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## @@ -179,88 +67,16 @@ sub invoke_cmd { } else { $machine = "CEC"; } - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - - ################################## - # Open databases needed - ################################## - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################## - # Get node power type - ################################## - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################# - # Get node type - ################################# - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################# - # Check for type - ################################# - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################# - # Check for valid "type" - ################################# - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################# - # Get attributes - ################################# - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################# - # Verify required attributes - ################################# - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - # - #my $fsp_name = $att->{hcp}; - #my $id = $att->{id}; - #use xcatd to get the attribute $fsp_name and $id of the node. - - #my $fsp_api ="/opt/xcat/sbin/fsp-api"; my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api"; my $action = "console"; my $type = "0"; - - #my $fsp_ip = (); my $Rc = 0; - - #$fsp_ip = xCAT::NetworkUtils::getNodeIPaddress( $fsp_name ); - #if(!defined($fsp_ip)) { - # return "Failed to get the $fsp_name\'s ip"; - #} my $power_state_cmd = "$fsp_api -a cec_state -t $type:$fsp_ip:$id:$node: 2>&1"; my $res; my $index = 0; my $pre_state = undef; - #my $wait_interval =20; my $ipl_num = 0; while (1) { $res = xCAT::Utils->runcmd($power_state_cmd, -1); @@ -317,18 +133,11 @@ sub invoke_cmd { sleep 5; } else { $pre_state = $res; - - #print "."; sleep 20; } - - #$wait_interval =20+int(rand(20)); - #sleep $wait_interval; } my $cmd = "$fsp_api -a $action -t $type:$fsp_ip:$id:$node:\r"; - - #print "cmd: $cmd\n"; my $running_failed_code = "Reason code: 0x1000000"; my $fsp_standby_msg = "Reason code: 0x1300"; my $fsp_lock_msg = "Reason code: 0x1f00"; @@ -397,9 +206,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -434,6 +240,3 @@ if ($result ne "0") { } exit(0); - - - diff --git a/xCAT-server/share/xcat/cons/hmc b/xCAT-server/share/xcat/cons/hmc index b956f4f0f..ae0425731 100644 --- a/xCAT-server/share/xcat/cons/hmc +++ b/xCAT-server/share/xcat/cons/hmc @@ -32,19 +32,11 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); use lib "$::XCATROOT/lib/perl"; require xCAT::Client; use strict; - -#use Getopt::Long; -#use xCAT::Table; -#use xCAT::PPCdb; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use Data::Dumper; require File::Basename; @@ -62,192 +54,10 @@ my $mtms; my @cred; my $credencial; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { -# -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## sub invoke_cmd { - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - # - ################################### - ## Open databases needed - ################################### - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################### - ## Get node power type - ################################### - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################## - ## Get node type - ################################## - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################## - ## Check for type - ################################## - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################## - ## Check for valid "type" - ################################## - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################## - ## Get attributes - ################################## - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################## - ## Verify required attributes - ################################## - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - ################################## - ## Find MTMS in vpd database - ################################## - #my @attrs = qw(mtm serial); - #my ($vpd) = $tabs{vpd}->getNodeAttribs($att->{parent}, \@attrs ); - # - #if ( !defined( $vpd )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "vpd" )); - #} - ################################# - ## Verify both vpd attributes - ################################# - #foreach ( @attrs ) { - # if ( !exists( $vpd->{$_} )) { - # return( sprintf( $errmsg{NO_ATTR}, $_, "vpd" )); - # } - #} - #my $mtms = "$vpd->{mtm}*$vpd->{serial}"; - #my $host = $att->{hcp}; - #my $lparid = $att->{id}; - #$type = "lpar"; - my $type = "lpar"; my $hwtype = "hmc"; my %request = ( @@ -257,7 +67,6 @@ sub invoke_cmd { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -281,9 +90,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -308,7 +114,7 @@ until ($lparid and $host and $mtms) { get_lock(); xCAT::Client::submit_request($cmdref, \&getans); } -release_lock(); #done with xcatd, can run with near impunity +release_lock(); #done with xcatd, can run with near impunity $node = $ARGV[0]; @@ -319,6 +125,3 @@ if ($result ne "0") { } exit(0); - - - diff --git a/xCAT-server/share/xcat/cons/hpblade b/xCAT-server/share/xcat/cons/hpblade index 2fe780c51..1a63bfd6e 100755 --- a/xCAT-server/share/xcat/cons/hpblade +++ b/xCAT-server/share/xcat/cons/hpblade @@ -38,10 +38,6 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd use lib "$::XCATROOT/lib/perl"; @@ -51,43 +47,11 @@ require xCAT::Client; require File::Basename; import File::Basename; my $scriptname = $0; - -#$mptab = xCAT::Table->new('mp'); -#unless ($mptab) { -#sleep 5; #Try not to overwhelm logfiles... -# die "mp table must be configured"; -#} -#$mpatab = xCAT::Table->new('mpa'); -#$passtab = xCAT::Table->new('passwd'); - my $username = "admin"; my $passsword = "PASSW0RD"; my $mm; my $slot; -#my $dba; -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>blade},qw(username password)); -# if ($dba->{username}) { -# $username = $dba->{username}; -# } -# if ($dba->{password}) { -# $password = $dba->{password}; -# } -#} - -#$dba = $mptab->getNodeAttribs($ARGV[0],[qw(mpa id)]); -#$mm = $dba->{mpa}; -#$slot = $dba->{id}; -#if ($mpatab) { -# ($dba) = $mpatab->getAttribs({mpa=>$mm},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} -#xCAT::Utils::close_all_dbhs; -#sleep 5; #Slow start, I know, but with exec, can't return sub getans { my $rsp = shift; if ($rsp->{node}) { @@ -115,8 +79,6 @@ $sleepint = 10 + int(rand(30)); #Stagger sleep to take it easy on AMM/hosting se exec "ssh -t $username" . "@" . "$mm vsp"; my $pathtochild = dirname($scriptname) . "/"; -#exec $pathtochild."hpblade.expect"; - #SECURITY: In this case, the authentication is expected to be done using the script user's ssh keys. As such, #this script does not receive any particularly sensitive data from the xCAT server. diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index 48d22d406..6dc4a4ed0 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -94,28 +94,6 @@ if ($password) { $pass = ''; } -#require xCAT::Table; -#require xCAT::Utils; -#my $dba; -#my $ipmitab = xCAT::Table->new('ipmi'); -#unless ($ipmitab) { die "Unable to open IPMI table"; } -#my $passtab = xCAT::Table->new('passwd'); -#if ($passtab) { -# ($dba) = $passtab->getAttribs({key=>'ipmi'},qw(username password)); -# if ($dba) { -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -# } -#} - -#$dba = $ipmitab->getNodeAttribs($ARGV[0],[qw(bmc username password)]); -#if ($dba) { -# if ($dba->{bmc}) { $bmc = $dba->{bmc}; } -# if ($dba->{username}) { $username = $dba->{username}; } -# if ($dba->{password}) { $password = $dba->{password}; } -#} -#xCAT::Utils::close_all_dbhs; -#my $isintel = system "ipmitool -I lanplus -U $username -P $password -H $bmc chassis status > /dev/null 2>&1"; my $isintel = 0; my $sleepint; my $rc; @@ -123,7 +101,7 @@ my $ipmitool = "ipmitool"; if (-x "$XCATROOT/bin/ipmitool-xcat") { $ipmitool = "$XCATROOT/bin/ipmitool-xcat"; } -my @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; #| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; +my @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; $rc = $?; if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI 1.5 formats for BMC capability determination, attempt IPMI 2.0 even without the ability to confirm IPMI 2.0 support. Though SOL was not baked in prior IPMI 2.0, this script supports pre-2.0 'ISOL' on older devices, hence why we are checking for 1.5/2.0 before proceeding normally @mcinfo = `$ipmitool -I lan $user $pass -H $bmc mc info`; @@ -133,7 +111,7 @@ while ($rc != 0) { $sleepint = 10 + int(rand(20)); print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n"; sleep ($sleepint); - @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; #| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; + @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; $rc = $?; if ($rc) { #repeat workaround for shoddy vendors @mcinfo = `$ipmitool -I lan $user $pass -H $bmc mc info`; diff --git a/xCAT-server/share/xcat/cons/ivm b/xCAT-server/share/xcat/cons/ivm index 40e847b52..a84e7f659 100755 --- a/xCAT-server/share/xcat/cons/ivm +++ b/xCAT-server/share/xcat/cons/ivm @@ -62,192 +62,10 @@ my $mtms; my @cred; my $credencial; -########################################## -# Database errors -########################################## -#my %errmsg = ( -# NODE_UNDEF =>"Node not defined in '%s' database", -# NO_ATTR =>"'%s' not defined in '%s' database", -# DB_UNDEF =>"'%s' database not defined" -#); - - - -########################################################################## -# Parse the command line for options and operands -########################################################################## -#sub parse_args { -# -# my %opt = (); -# my @VERSION = qw( 2.0 ); -# -# ############################################# -# # Responds with usage statement -# ############################################# -# local *usage = sub { -# -# my $cmd = __FILE__; -# $cmd =~ s/.*([\w]{3}$)/$1/; -# -# if ( defined( $_[0] )) { -# print STDERR "$_[0]\n"; -# } -# my @msg = ( -# "$cmd -h|--help\n", -# "$cmd -v|--version\n", -# "$cmd singlenode [-V|-Verbose]\n" ); -# print STDERR @msg; -# }; -# ############################################# -# # Process command-line arguments -# ############################################# -# if ( !defined( @ARGV )) { -# usage( "No node specified" ); -# return(1); -# } -# ############################################# -# # Checks case in GetOptions, allows opts -# # to be grouped (e.g. -vx), and terminates -# # at the first unrecognized option. -# ############################################# -# $Getopt::Long::ignorecase = 0; -# Getopt::Long::Configure( "bundling" ); -# -# if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version) )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -h for Help -# ####################################### -# if ( exists( $opt{h} )) { -# usage(); -# return(1); -# } -# ####################################### -# # Option -v for version -# ####################################### -# if ( exists( $opt{v} )) { -# print STDERR \@VERSION; -# return(1); -# } -# ####################################### -# # Option -V for verbose output -# ####################################### -# if ( exists( $opt{V} )) { -# $verbose = 1; -# } -# ####################################### -# # Check for "-" with no option -# ####################################### -# if ( grep(/^-$/, @ARGV )) { -# usage( "Missing option: -" ); -# return(1); -# } -# ####################################### -# # Get node -# ####################################### -# if ( !defined( $ARGV[0] )) { -# usage( "No node specified" ); -# return(1); -# } -# ####################################### -# # Check for extra argument -# ####################################### -# $node = shift @ARGV; -# if ( defined( $ARGV[0] )) { -# usage( "Invalid Argument: $ARGV[0]" ); -# return(1); -# } -# return(0); -#} - - - ########################################################################## # Open remote console ########################################################################## sub invoke_cmd { - - #my @attribs = qw(id parent hcp); - #my %tabs = (); - # - ################################### - ## Open databases needed - ################################### - #foreach ( qw(ppc vpd nodetype) ) { - # $tabs{$_} = xCAT::Table->new($_); - # - # if ( !exists( $tabs{$_} )) { - # return( sprintf( $errmsg{DB_UNDEF}, $_ )); - # } - #} - ################################### - ## Get node power type - ################################### - #my $hwtype = __FILE__; - #$hwtype =~ s/.*([\w]{3})$/$1/; - # - ################################## - ## Get node type - ################################## - #my ($ent) = $tabs{nodetype}->getNodeAttribs($node, ["nodetype"] ); - #if ( !defined( $ent )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "nodetype" )); - #} - ################################## - ## Check for type - ################################## - #if ( !exists( $ent->{nodetype} )) { - # return( sprintf( $errmsg{NO_ATTR}, $ent->{nodetype},"nodetype" )); - #} - ################################## - ## Check for valid "type" - ################################## - #my @types = split /,/, $ent->{nodetype}; - #my ($type) = grep( /^(lpar|osi)$/, @types ); - # - #if ( !defined( $type )) { - # return( "Invalid node type: $ent->{nodetype}" ); - #} - ################################## - ## Get attributes - ################################## - #my ($att) = $tabs{ppc}->getAttribs({'node'=>$node}, @attribs ); - # - #if ( !defined( $att )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "ppc" )); - #} - ################################## - ## Verify required attributes - ################################## - #foreach my $at ( @attribs ) { - # if ( !exists( $att->{$at} )) { - # return( sprintf( $errmsg{NO_ATTR}, $at, "ppc" )); - # } - #} - ################################## - ## Find MTMS in vpd database - ################################## - #my @attrs = qw(mtm serial); - #my ($vpd) = $tabs{vpd}->getNodeAttribs($att->{parent}, \@attrs ); - # - #if ( !defined( $vpd )) { - # return( sprintf( $errmsg{NODE_UNDEF}, "vpd" )); - #} - ################################# - ## Verify both vpd attributes - ################################# - #foreach ( @attrs ) { - # if ( !exists( $vpd->{$_} )) { - # return( sprintf( $errmsg{NO_ATTR}, $_, "vpd" )); - # } - #} - #my $mtms = "$vpd->{mtm}*$vpd->{serial}"; - #my $host = $att->{hcp}; - #my $lparid = $att->{id}; - #$type = "lpar"; - my $type = "lpar"; my $hwtype = "ivm"; my %request = ( @@ -257,7 +75,6 @@ sub invoke_cmd { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -281,9 +98,6 @@ sub invoke_cmd { ############################################## # Start main body of code ############################################## -#if ( parse_args() ) { -# exit(1); -#} sub getans { my $rsp = shift; @@ -322,7 +136,3 @@ if ($result ne "0") { exit(1); } exit(0); - - - - diff --git a/xCAT-server/share/xcat/cons/kvm b/xCAT-server/share/xcat/cons/kvm index c122799ad..c5b9899cd 100755 --- a/xCAT-server/share/xcat/cons/kvm +++ b/xCAT-server/share/xcat/cons/kvm @@ -33,19 +33,8 @@ BEGIN } get_lock(); - #my $sleepint=int(rand(10)); - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } -#BEGIN -#{ -# use Time::HiRes qw(sleep); -# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -# my $sleepint=int(rand(10)); -# print "Opening console in ".(0.5*$sleepint)." seconds...\n"; -# sleep (0.5*$sleepint); -#} my $sleepint; use lib "$::XCATROOT/lib/perl"; require xCAT::Client; @@ -90,9 +79,3 @@ if (!$ENV{'TERM'}) { exec "ssh -t $dsthost screen -U -a -O -e ^]a -d -R -S serial-" . $ARGV[0] . "-cons -A $dstty $speed"; -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - - - - diff --git a/xCAT-server/share/xcat/cons/multiple b/xCAT-server/share/xcat/cons/multiple index ff0feccf6..8e7d41f1e 100755 --- a/xCAT-server/share/xcat/cons/multiple +++ b/xCAT-server/share/xcat/cons/multiple @@ -138,7 +138,6 @@ sub invoke_hmc { ################################# # Get userid and password ################################# - #my @cred = xCAT::PPCdb::credentials( $host, $hwtype ); @cred = split(/,/, $credencial); $request{$host}{cred} = \@cred; ################################# @@ -228,7 +227,3 @@ for my $thishcp (keys %{ ${$hcps}[0] }) { } } exit(0); - - - - diff --git a/xCAT-server/share/xcat/cons/xen b/xCAT-server/share/xcat/cons/xen index 2cdf0b051..0d475b039 100755 --- a/xCAT-server/share/xcat/cons/xen +++ b/xCAT-server/share/xcat/cons/xen @@ -32,20 +32,8 @@ BEGIN exit 0; } get_lock(); - - #my $sleepint=int(rand(10)); - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; } -#BEGIN -#{ -# use Time::HiRes qw(sleep); -# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -# my $sleepint=int(rand(10)); -# print "Opening console in ".(0.5*$sleepint)." seconds...\n"; -# sleep (0.5*$sleepint); -#} my $sleepint; use lib "$::XCATROOT/lib/perl"; require xCAT::Client; @@ -81,10 +69,3 @@ until ($dsthost and $speed and $dstty) { } release_lock(); exec "ssh -t $dsthost screen -U -a -O -e ^]a -d -R -S serial-" . $ARGV[0] . "-cons -A $dstty $speed"; - -#my $pathtochild= dirname($scriptname). "/"; -#exec $pathtochild."blade.expect $mm $slot $username $password"; - - - -