From b32ef4dbef492ffd65681813924c247da9ae8ac6 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 31 Jul 2013 19:31:18 +0200 Subject: [PATCH] test-driver/Machine: Add new allowReboot flag. This is to actually allow for the target machine to reboot, which could come in handy for some VM tests in NixOps. Well, actually to be more specific: We need it for the Hetzner NixOps backend test. :-) Signed-off-by: aszlig --- lib/test-driver/Machine.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index 615fe09bdfc6..c56e650ed361 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -48,9 +48,13 @@ sub new { make_path($sharedDir, { mode => 0700, owner => $< }); } + my $allowReboot = 0; + $allowReboot = $args->{allowReboot} if defined $args->{allowReboot}; + my $self = { startCommand => $startCommand, name => $name, + allowReboot => $allowReboot, booted => 0, pid => 0, connected => 0, @@ -136,7 +140,8 @@ sub start { $ENV{SHARED_DIR} = $sharedDir; $ENV{USE_TMPDIR} = 1; $ENV{QEMU_OPTS} = - "-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " . + ($self->{allowReboot} ? "" : "-no-reboot ") . + "-monitor unix:./monitor -chardev socket,id=shell,path=./shell " . "-device virtio-serial -device virtconsole,chardev=shell " . ($showGraphics ? "-serial stdio" : "-nographic") . " " . ($ENV{QEMU_OPTS} || ""); chdir $self->{stateDir} or die;