Annelidous-snapshot
view release on metacpan or search on metacpan
Annelidous/Connector/Xen.pm view on Meta::CPAN
#!/usr/bin/perl
#
# Annelidous - the flexibile cloud management framework
# Copyright (C) 2009 Eric Windisch <eric@grokthis.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
package Annelidous::Connector::Xen;
use base 'Annelidous::Connector';
use Data::Dumper;
#use Annelidous::Transport::SSH;
sub new {
my $invocant = shift;
my $class = ref($invocant) || $invocant;
my $self={
-transport=>'Annelidous::Transport::SSH',
-vm=>undef,
@_
};
bless $self, $class;
if (defined($self->{-vm})) {
$self->vm($self->{-vm});
}
$self->transport($self->{-transport},{-host=>$self->vm->get_host});
return $self;
}
# Launch client guest OS into rescue mode
# takes a client_pool as argument
sub rescue {
my $self=shift;
my $guest=$self->vm->data;
#my @userinfo=getpwent($guest->{username});
#my $homedir=$userinfo[7];
my $hostname=$self->vm->get_host();
my $guestVG="XenDomains";
my $swapVG="XenDomains";
if ($hostname =~ /(rorschach|fury)\.grokthis\.net/i) {
$guestVG="SanXenDomains";
$swapVG="XenSwap";
}
#print "Starting guest: ".$guest->{username}."\n";
my @exec=("xm","create",
"/dev/null",
"name='".$guest->{username}."'",
( run in 0.767 second using v1.01-cache-2.11-cpan-7f9471e7e0a )