summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-19 21:51:09 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-19 21:51:09 +0100
commitc2941c9f0b8a48e4ab190c087b7f32c64d76aa8e (patch)
treebab3ac88190b1afa8aacc13e1ac1c0f6f044ab85 /source4
parentab915504aaa40cebe5fa09a47b2ae46f7f9f334a (diff)
downloadsamba-c2941c9f0b8a48e4ab190c087b7f32c64d76aa8e.tar.gz
samba-c2941c9f0b8a48e4ab190c087b7f32c64d76aa8e.tar.bz2
samba-c2941c9f0b8a48e4ab190c087b7f32c64d76aa8e.zip
Initial work on vde support.
(This used to be commit 9b0dcac0bd805c3e1741448167b461c3fa0e33fd)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/selftest/selftest.pl2
-rw-r--r--source4/selftest/target/Kvm.pm26
2 files changed, 21 insertions, 7 deletions
diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl
index c17e790f63..996b982e06 100755
--- a/source4/selftest/selftest.pl
+++ b/source4/selftest/selftest.pl
@@ -452,7 +452,7 @@ if ($opt_target eq "samba4") {
if ($opt_socket_wrapper);
require target::Kvm;
die("No image specified") unless ($opt_image);
- $target = new Kvm($opt_image);
+ $target = new Kvm($opt_image, undef);
}
sub read_test_regexes($)
diff --git a/source4/selftest/target/Kvm.pm b/source4/selftest/target/Kvm.pm
index 253f3b53af..3b17a2909c 100644
--- a/source4/selftest/target/Kvm.pm
+++ b/source4/selftest/target/Kvm.pm
@@ -11,9 +11,10 @@ use FindBin qw($RealBin);
use POSIX;
sub new($$$$) {
- my ($classname, $dc_image) = @_;
+ my ($classname, $dc_image, $vdesocket) = @_;
my $self = {
dc_image => $dc_image,
+ vdesocket => $vdesocket,
};
bless $self;
return $self;
@@ -60,8 +61,10 @@ sub teardown_env($$)
kill 9, $envvars->{KVM_PID};
- print "Killing dhcpd instance $envvars->{DHCPD_PID}\n";
- kill 9, $envvars->{DHCPD_PID};
+ if (defined($envvars->{DHCPD_PID})) {
+ print "Killing dhcpd instance $envvars->{DHCPD_PID}\n";
+ kill 9, $envvars->{DHCPD_PID};
+ }
return 0;
}
@@ -105,11 +108,22 @@ sub start($$$)
$opts .= " -loadvm $ENV{KVM_SNAPSHOT}";
}
- my ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9");
+ my $netopts;
+ my $dhcp_pid;
+ my $ip_address;
+
+ if ($self->{vdesocket}) {
+ $netopts = "vde,socket=$self->{vdesocket}";
+ } else {
+ my $ifup_script, $dhcpd_pidfile;
+ ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9");
+ $netopts = "tap,script=$ifup_script";
+ $dhcp_pid = read_pidfile($dhcpd_pidfile);
+ }
- system("kvm -name \"Samba 4 Test Subject\" $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net tap,script=$ifup_script");
+ system("kvm -name \"Samba 4 Test Subject\" $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net $netopts");
- return (read_pidfile($pidfile), read_pidfile($dhcpd_pidfile), $ip_address);
+ return (read_pidfile($pidfile), $dhcp_pid, $ip_address);
}
sub setup_env($$$)