From 6a92ab207cb9b8d3f8e092f999f2b3dfc4dd8fcd Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 30 Jul 2008 18:46:11 +0000 Subject: [PATCH] -Add getvmcons command to Xen to retrieve current text and vid consoles git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1965 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/xen.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index d1b611989..601cd0c07 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -43,6 +43,7 @@ sub handled_commands { return { rpower => 'nodehm:power,mgt', rmigrate => 'nodehm:mgt', + getvmcons => 'nodehm:mgt', #rvitals => 'nodehm:mgt', #rinv => 'nodehm:mgt', rbeacon => 'nodehm:mgt', @@ -167,6 +168,27 @@ sub refresh_vm { my $vncport=$newxml->{devices}->{graphics}->{port}; my $stty=$newxml->{devices}->{console}->{tty}; $vmtab->setNodeAttribs($node,{vncport=>$vncport,textconsole=>$stty}); + return {vncport=>$vncport,textconsole=>$stty}; +} + +sub getvmcons { + my $node = shift(); + my $type = shift(); + my $dom; + eval { + $dom = $hypconn->get_domain_by_name($node); + }; + unless ($dom) { + return 1,"Unable to query running VM"; + } + my $consdata=refresh_vm($dom); + my $hyper=$vmhash->{$node}->[0]->{host}; + if ($type eq "text") { + return (0,'tty@'.$hyper.": ".$consdata->{textconsole}); + } elsif ($type eq "vnc") { + print Dumper($consdata); + return (0,'ssh+vnc@'.$hyper.": ".$consdata->{vncport}); + } } sub migrate { @@ -275,6 +297,8 @@ sub guestcmd { return power(@args); } elsif ($command eq "rmigrate") { return migrate($node,@args); + } elsif ($command eq "getvmcons") { + return getvmcons($node,@args); } =cut } elsif ($command eq "rvitals") {