diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm
index 138d7e182..446ea7782 100644
--- a/perl-xCAT/xCAT/Schema.pm
+++ b/perl-xCAT/xCAT/Schema.pm
@@ -603,8 +603,8 @@ noderes => {
privacy => 'The privacy protocol to use for v3. DES is assumed if v3 enabled, as it is the most readily available.',
auth => 'The authentication protocol to use for SNMPv3. SHA is assumed if v3 enabled and this is unspecified',
linkports => 'The ports that connect to other switches. Currently, this column is only used by vlan configuration. The format is: "port_number:switch,port_number:switch...". Please refer to the switch table for details on how to specify the port numbers.',
- sshusername => 'The user name for ssh. For Ethernet switches, it can be user name for telnet if ssh is not set up.',
- sshpassword => 'The password for ssh. For Ethernet switches, it can be password for telnet if ssh is not set up.',
+ sshusername => 'The user name for ssh. For Ethernet switches, it can be telnet username, use the format "tn:username" to indicate that it is for telnet.',
+ sshpassword => 'The password for ssh. For Ethernet switches, it can be password for telnet.',
switchtype => 'The type of switch. It is used to identify the file name that implements the functions for this swithc. The valid values are: MellanoxIB etc.',
},
},
diff --git a/xCAT-client/pods/man1/xdsh.1.pod b/xCAT-client/pods/man1/xdsh.1.pod
index a181263d6..1d1d0e311 100644
--- a/xCAT-client/pods/man1/xdsh.1.pod
+++ b/xCAT-client/pods/man1/xdsh.1.pod
@@ -209,14 +209,14 @@ of relevant device configuration file. The devicetype value must
correspond to a valid device configuration file.
xCAT ships some default configuration files
for Ethernet switches and and IB switches under
-/opt/xcat/share/xcat/devicetype directory. If you want to overwrite
-any of the configuration files, please copy it to /var/opt/xcat/
+I directory. If you want to overwrite
+any of the configuration files, please copy it to I
directory and cutomize it.
-For example, /IBSwitch/Qlogic/config is the configuration
+For example, I is the configuration
file location if devicetype is specified as IBSwitch::Qlogic.
-xCAT will first search config file using /var/opt/xcat/ as the base.
+xCAT will first search config file using I as the base.
If not found, it will search for it using
-/opt/xcat/share/xcat/devicetype/ as the base.
+I as the base.
=item B<-f>|B<--fanout> I
@@ -552,7 +552,7 @@ To define a BNT Ethernet switch as a node and run a command to create a new vlan
B I
B I
- where and can be SSH or Telnet user name and password for the switch.
+ where I and I are the SSH user name and password for the switch. If it is for Telnet, add I in front of the user name: I.
I
diff --git a/xCAT-server/lib/perl/xCAT/RShellAPI.pm b/xCAT-server/lib/perl/xCAT/RShellAPI.pm
index 141e81d71..65feaa31f 100644
--- a/xCAT-server/lib/perl/xCAT/RShellAPI.pm
+++ b/xCAT-server/lib/perl/xCAT/RShellAPI.pm
@@ -27,6 +27,7 @@ use xCAT::MsgUtils;
#####################################################
sub remote_shell_command {
my ( $class, $config, $exec_path ) = @_;
+ #print Dumper($config);
my @command = ();
@@ -42,8 +43,19 @@ sub remote_shell_command {
push @command, "-v";
}
if ($$config{'user'} && ($$config{'user'} !~ /^none$/i)) {
- @tmp=split(' ', "-l $$config{'user'}");
- push @command, @tmp;
+ my $username=$$config{'user'};
+ my $telnet=0;
+ if ($username =~ /^(tn:)(.*)$/) {
+ $telnet=1;
+ $username=$2;
+ }
+ if ($telnet) {
+ push @command, "-t";
+ }
+ if ($username) {
+ @tmp=split(' ', "-l $username");
+ push @command, @tmp;
+ }
}
if ($$config{'password'} && ($$config{'password'} !~ /^none$/i)) {
@tmp=split(' ', "-p $$config{'password'}");
@@ -77,29 +89,33 @@ sub run_remote_shell_api {
my $node=shift;
my $user=shift;
my $passwd=shift;
+ my $telnet=shift;
my $verbose=shift;
my $args = join(" ", @_);
my $t;
my $prompt='.*[\>\#\$]\s*$';
my $more_prompt='(.*key to continue.*|.*--More--\s*|.*--\(more.*\)--.*$)';
my $output;
+ my $errmsg;
- eval {
- $output="start SSH session...\n";
- $t = new xCAT::SSHInteract(
- -username=>$user,
- -password=>$passwd,
- -host=>$node,
- -nokeycheck=>1,
- -output_record_separator=>"\r",
- Timeout=>10,
- Errmode=>'return',
- Prompt=>"/$prompt/",
- );
- };
- my $errmsg=$@;
- $errmsg =~ s/ at (.*) line (\d)+//g;
- $output.="$errmsg\n";
+ if (!$telnet) {
+ eval {
+ $output="start SSH session...\n";
+ $t = new xCAT::SSHInteract(
+ -username=>$user,
+ -password=>$passwd,
+ -host=>$node,
+ -nokeycheck=>1,
+ -output_record_separator=>"\r",
+ Timeout=>10,
+ Errmode=>'return',
+ Prompt=>"/$prompt/",
+ );
+ };
+ $errmsg=$@;
+ $errmsg =~ s/ at (.*) line (\d)+//g;
+ $output.="$errmsg\n";
+ }
my $rc=1;
if ($t) {
diff --git a/xCAT-server/sbin/rshell_api b/xCAT-server/sbin/rshell_api
index aabe637fd..ef2f42f9f 100755
--- a/xCAT-server/sbin/rshell_api
+++ b/xCAT-server/sbin/rshell_api
@@ -15,22 +15,24 @@ Getopt::Long::Configure("no_pass_through");
my $username;
my $passwd;
+my $telnet;
my $help;
my $verbose;
if (!GetOptions(
'l|loginname=s' => \$username,
'p|password=s' => \$passwd,
+ 't|telnet' => \$telnet, #use telnet, otherwise ssh
'h|help' => \$help,
'v|verbose'=> \$verbose,
) || $help || scalar(@ARGV)<2 ) {
- print "Usage: rshell_api [-v] [-l ] [-p ] \n";
+ print "Usage: rshell_api [-v] [-t] [-l ] [-p ] \n";
exit;
}
my $node = $ARGV[0];
-my $output =xCAT::RShellAPI::run_remote_shell_api($node, $username, $passwd, $verbose, @ARGV[1 .. $#ARGV]);
+my $output =xCAT::RShellAPI::run_remote_shell_api($node, $username, $passwd, $telnet, $verbose, @ARGV[1 .. $#ARGV]);
my $rc=0;
my $data;
if ($output && (@$output > 1)) {