diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 601cd0c07..f284d5578 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -16,6 +16,7 @@ use strict; #use warnings; my %vm_comm_pids; my $vmhash; +my $hmhash; use XML::Simple; if ($^O =~ /^linux/i) { @@ -61,6 +62,7 @@ my $hyp; my $doreq; my %hyphash; my $node; +my $hmtab; my $vmtab; sub waitforack { @@ -183,10 +185,14 @@ sub getvmcons { } my $consdata=refresh_vm($dom); my $hyper=$vmhash->{$node}->[0]->{host}; + if ($type eq "text") { - return (0,'tty@'.$hyper.": ".$consdata->{textconsole}); + my $serialspeed; + if ($hmhash) { + $serialspeed=$hmhash->{$node}->[0]->{serialspeed}; + } + return (0,'tty@'.$hyper.": ".$consdata->{textconsole}."@".$serialspeed); } elsif ($type eq "vnc") { - print Dumper($consdata); return (0,'ssh+vnc@'.$hyper.": ".$consdata->{vncport}); } } @@ -391,6 +397,10 @@ sub grab_table_data{ my $noderange=shift; my $callback=shift; $vmtab = xCAT::Table->new("vm"); + $hmtab = xCAT::Table->new("nodehm"); + if ($hmtab) { + $hmhash = $hmtab->getNodesAttribs($noderange,['serialspeed']); + } unless ($vmtab) { $callback->({data=>["Cannot open vm table"]}); return; diff --git a/xCAT-server/share/xcat/cons/xen b/xCAT-server/share/xcat/cons/xen new file mode 100755 index 000000000..28b8eb043 --- /dev/null +++ b/xCAT-server/share/xcat/cons/xen @@ -0,0 +1,48 @@ +#!/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)); + print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; + #sleep $sleepint; +} +use lib "$::XCATROOT/lib/perl"; +require xCAT::Client; + +require File::Basename; +import File::Basename; +my $scriptname = $0; + +my $cmdref={ + command=>"getvmcons", + arg=>"text", + noderange=>$ARGV[0] +}; +use Data::Dumper; +my $dsthost; +my $dstty; +my $speed; +sub getans { + my $rsp = shift; + if ($rsp->{node}) { + $dsthost = $rsp->{node}->[0]->{data}->[0]->{desc}->[0]; + $dsthost=~s/.*@//; + $dstty = $rsp->{node}->[0]->{data}->[0]->{contents}->[0]; + $speed=$dstty; + print $speed; + $dstty =~ s/@.*$//; + $speed =~ s/^.*@//; + } +} +xCAT::Client::submit_request($cmdref,\&getans); +print "$dsthost $speed $dstty\n"; +exec "ssh -t $dsthost cu -s $speed -l $dstty"; + +#my $pathtochild= dirname($scriptname). "/"; +#exec $pathtochild."blade.expect $mm $slot $username $password"; + + + +