[Tools] testbot/Engine: On startup stop stale RevertVM.pl processes and consider the VMs dirty.

Francois Gouget fgouget at codeweavers.com
Wed Aug 29 09:39:49 CDT 2012


On startup we don't know what state the VMs are in: they may be shut off following a VM host reboot or they may still be running old tasks. So consider them all to be dirty (i.e. in need of a revert before use).
---
 testbot/bin/Engine.pl |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index a4db2e1..f63344b 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -541,6 +541,25 @@ sub ClientRead
   return $GotSomething;
 }
 
+sub InitVMs()
+{
+  # Kill any stale RevertVM.pl process so they don't mess with our VMs
+  system('killall RevertVM.pl 2>/dev/null');
+
+  # On startup we don't know what state the VMs are in. So consider them all
+  # to be dirty.
+  my $VMs = CreateVMs();
+  foreach my $VMKey (@{$VMs->GetKeys()})
+  {
+    my $VM = $VMs->GetItem($VMKey);
+    if ($VM->Status ne "offline")
+    {
+        $VM->Status("dirty");
+        $VM->Save();
+    }
+  }
+}
+
 sub SafetyNet
 {
   my $Jobs = CreateJobs();
@@ -635,6 +654,8 @@ sub main
 
   $WineTestBot::Engine::Notify::RunningInEngine = 1;
 
+  InitVMs();
+
   my $SockName = "$DataDir/socket/engine";
   my $uaddr = sockaddr_un($SockName);
   my $proto = getprotobyname('tcp');
-- 
1.7.10.4




More information about the wine-patches mailing list