From 48e71522e4b039df26b571e8ca4c995ded4dfa44 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 11 Dec 2008 19:37:14 +0000 Subject: [PATCH] -Add wvid support for Xen guests git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2544 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/share/xcat/rvid/rvid.xen | 5 ++++ xCAT-server/lib/xcat/plugins/xen.pm | 35 +++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 xCAT-client/share/xcat/rvid/rvid.xen diff --git a/xCAT-client/share/xcat/rvid/rvid.xen b/xCAT-client/share/xcat/rvid/rvid.xen new file mode 100755 index 000000000..115a53231 --- /dev/null +++ b/xCAT-client/share/xcat/rvid/rvid.xen @@ -0,0 +1,5 @@ +#!/bin/bash +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +myport=${rvid_vncdisplay#*:} +let myport=myport-5900; +vncviewer :$myport -via $rvid_server diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 497f7438f..accd38b88 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -57,6 +57,7 @@ sub handled_commands { getxencons => 'nodehm:mgt', #rvitals => 'nodehm:mgt', #rinv => 'nodehm:mgt', + getrvidparms => 'nodehm:mgt', rbeacon => 'nodehm:mgt', revacuate => 'vm:virtflags', #rspreset => 'nodehm:mgt', @@ -278,7 +279,35 @@ sub getvmcons { $sconsparms->{node}->[0]->{baudrate}=[$serialspeed]; return (0,$sconsparms); } elsif ($type eq "vnc") { - return (0,'ssh+vnc@'.$hyper.": ".$consdata->{vncport}); + my $domdata=`ssh $hyper xm list $node -l`; + my @domlines = split /\n/,$domdata; + my $foundvfb=0; + my $vnclocation; + foreach (@domlines) { + if (/\(vfb/) { + $foundvfb=1; + } + if ($foundvfb and /location\s+([^\)]+)/) { + $vnclocation=$1; + $foundvfb=0; + last; + } + } + return (0,'ssh+vnc@'.$hyper.": ".$vnclocation); #$consdata->{vncport}); + } +} +sub getrvidparms { + my $node=shift; + my $location = getvmcons($node,"vnc"); + if ($location =~ /ssh\+vnc@([^:]*):([^:]*):(\d+)/) { + my @output = ( + "method: xen", + "server: $1", + "vncdisplay: $2:$3", + ); + return 0,@output; + } else { + return (1,"Error: Unable to determine rvid destination for $node"); } } @@ -371,6 +400,8 @@ sub getpowstate { } } + + sub power { my $subcommand = shift; my $retstring; @@ -441,6 +472,8 @@ sub guestcmd { return power(@args); } elsif ($command eq "rmigrate") { return migrate($node,@args); + } elsif ($command eq "getrvidparms") { + return getrvidparms($node,@args); } elsif ($command eq "getxencons") { return getvmcons($node,@args); }