Allow loading kvm snapshots.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 19 Feb 2008 16:23:38 +0000 (17:23 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 19 Feb 2008 16:23:38 +0000 (17:23 +0100)
source/selftest/target/Kvm.pm

index 7799cb7ec045133160e6011c41fbd4be57163ad3..b1ad8fcefa9c72afe5f1cb31395adb2ae97421b8 100644 (file)
@@ -101,9 +101,13 @@ sub start($$$)
 
        my $opts = (defined($ENV{KVM_OPTIONS})?$ENV{KVM_OPTIONS}:"-nographic");
 
+       if (defined($ENV{KVM_SNAPSHOT})) {
+               $opts .= " -loadvm $ENV{KVM_SNAPSHOT}";
+       }
+
        my ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9");
 
-       system("kvm $opts -daemonize -pidfile $pidfile -snapshot $image -net nic -net tap,script=$ifup_script");
+       system("kvm $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net tap,script=$ifup_script");
 
        return (read_pidfile($pidfile), read_pidfile($dhcpd_pidfile), $ip_address);
 }