Francois Gouget : testbot/VMs: Shut down VMs before reverting them.

Alexandre Julliard julliard at winehq.org
Mon Sep 30 13:43:26 CDT 2013


Module: tools
Branch: master
Commit: d07df9daf9e3e2bc1ec27bd5140f9c99245f6088
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=d07df9daf9e3e2bc1ec27bd5140f9c99245f6088

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Fri Sep 27 20:01:22 2013 +0200

testbot/VMs: Shut down VMs before reverting them.

This is a workaround for a bug in some QEmu/KVM versions.

---

 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 acd3b5b..5f98191 100755
--- a/testbot/bin/RevertVM.pl
+++ b/testbot/bin/RevertVM.pl
@@ -97,6 +97,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 c92b534..37d1c4f 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -362,9 +362,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);
@@ -372,7 +372,8 @@ sub PowerOff
   eval { $Domain->destroy() };
   return $@->message() if ($@);
 
-  return $self->UpdateStatus($Domain);
+  return $self->UpdateStatus($Domain) if (!$NoStatus);
+  return undef;
 }
 
 sub GetAgent($)




More information about the wine-cvs mailing list