[2/2] testbot/VMs: Shut down VMs before reverting them.
Francois Gouget
fgouget at codeweavers.com
Fri Sep 27 13:01:22 CDT 2013
This is a workaround for a bug in some QEmu/KVM versions.
---
Specifically QEmu 1.6.0 complains about hardware incompatibility when
trying to revert a running VM to a running snapshot, which makes
absolutely no sense.
snapshot-revert fgtbwinxp wtb-sp2
error: revert requires force: Target device address type none does not match source pci
But forcibly shutting down the VM is fast (seconds) and then lets us do
the revert.
testbot/bin/RevertVM.pl | 11 +++++++++++
testbot/lib/WineTestBot/VMs.pm | 7 ++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/testbot/bin/RevertVM.pl b/testbot/bin/RevertVM.pl
index a253e76..01bcc08 100755
--- a/testbot/bin/RevertVM.pl
+++ b/testbot/bin/RevertVM.pl
@@ -98,6 +98,17 @@ if (defined($ErrMessage))
FatalError "Can't change status for VM $VMKey: $ErrMessage", $VM;
}
+if ($VM->IsPoweredOn())
+{
+ # Some QEmu/KVM versions are buggy and cannot revert a running VM
+ $ErrMessage = $VM->PowerOff(1);
+ if (defined $ErrMessage)
+ {
+ LogMsg "Could not shut down $VMKey: $ErrMessage\n";
+ LogMsg "Trying the revert anyway\n";
+ }
+}
+
$ErrMessage = $VM->RevertToSnapshot($VM->IdleSnapshot);
if (defined($ErrMessage))
{
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 3fcb644..9646048 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -368,9 +368,9 @@ sub PowerOn
return $self->UpdateStatus($Domain);
}
-sub PowerOff
+sub PowerOff($$)
{
- my ($self) = @_;
+ my ($self, $NoStatus) = @_;
my ($ErrMessage, $Domain) = $self->_GetDomain();
return $ErrMessage if (defined $ErrMessage);
@@ -378,7 +378,8 @@ sub PowerOff
eval { $Domain->destroy() };
return $@->message() if ($@);
- return $self->UpdateStatus($Domain);
+ return $self->UpdateStatus($Domain) if (!$NoStatus);
+ return undef;
}
sub GetAgent($)
--
1.8.4.rc3
More information about the wine-patches
mailing list