2008-07-31 17:32:39 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
use Time::HiRes qw(sleep);
|
|
|
|
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
|
|
|
my $sleepint=int(rand(10));
|
2008-08-12 12:59:14 +00:00
|
|
|
print "Opening console in ".(0.5*$sleepint)." seconds...\n";
|
|
|
|
sleep (0.5*$sleepint);
|
2008-07-31 17:32:39 +00:00
|
|
|
}
|
|
|
|
use lib "$::XCATROOT/lib/perl";
|
2008-07-31 21:06:33 +00:00
|
|
|
$ENV{HOME}='/root/';
|
2008-07-31 17:32:39 +00:00
|
|
|
require xCAT::Client;
|
|
|
|
|
|
|
|
require File::Basename;
|
|
|
|
import File::Basename;
|
|
|
|
my $scriptname = $0;
|
|
|
|
|
|
|
|
my $cmdref={
|
2008-08-12 17:15:48 +00:00
|
|
|
command=>"getxencons",
|
2008-07-31 17:32:39 +00:00
|
|
|
arg=>"text",
|
|
|
|
noderange=>$ARGV[0]
|
|
|
|
};
|
|
|
|
use Data::Dumper;
|
|
|
|
my $dsthost;
|
|
|
|
my $dstty;
|
|
|
|
my $speed;
|
|
|
|
sub getans {
|
|
|
|
my $rsp = shift;
|
|
|
|
if ($rsp->{node}) {
|
2008-08-12 17:15:48 +00:00
|
|
|
$dsthost = $rsp->{node}->[0]->{sshhost}->[0];
|
|
|
|
$dstty = $rsp->{node}->[0]->{psuedotty}->[0];
|
|
|
|
$speed = $rsp->{node}->[0]->{baudrate}->[0];
|
2008-07-31 17:32:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
xCAT::Client::submit_request($cmdref,\&getans);
|
2008-08-12 12:59:14 +00:00
|
|
|
until ($dsthost and $speed and $dstty) {
|
|
|
|
print "console not ready";
|
|
|
|
sleep 5+int(rand(10));
|
|
|
|
xCAT::Client::submit_request($cmdref,\&getans);
|
|
|
|
}
|
2008-07-31 17:32:39 +00:00
|
|
|
exec "ssh -t $dsthost cu -s $speed -l $dstty";
|
|
|
|
|
|
|
|
#my $pathtochild= dirname($scriptname). "/";
|
|
|
|
#exec $pathtochild."blade.expect $mm $slot $username $password";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|