diff options
Diffstat (limited to 'source4/selftest/target')
-rw-r--r-- | source4/selftest/target/Kvm.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/selftest/target/Kvm.pm b/source4/selftest/target/Kvm.pm index 533fb302d0..efd4fa2f7a 100644 --- a/source4/selftest/target/Kvm.pm +++ b/source4/selftest/target/Kvm.pm @@ -40,16 +40,39 @@ sub check_env($$) return 1; } +sub start($) +{ + my ($self) = @_; + + my $pidfile = "kvm.pid"; + + system("kvm $ENV{KVM_OPTIONS} -daemonize -pidfile $pidfile -net user -vnc unix:kvm.vnc -snapshot $self->{image}"); + + open(PID, $pidfile); + $self->{pid} = <PID>; + close(PID); +} + sub setup_env($$$) { my ($self, $envname, $path) = @_; + if ($envname eq "dc") { + unless (defined($self->{pid})) { + $self->start(); + } + } elsif ($envname eq "member") { + return undef; + } + die("No implemented yet"); } sub stop($) { my ($self) = @_; + + kill $self->{pid}; } 1; |