[PATCH] testbot/Engine: Ignore ChildPid & ChildDeadline for maintenance VMs.

Francois Gouget fgouget at codeweavers.com
Tue Sep 17 05:35:15 CDT 2019


For debugging it is useful to set a VM in maintenance mode and then
manually run scripts operating on that VM. When doing so ChildPid is
undefined since it is normally set by the Engine when starting the
script. But the scripts may modify other VM fields, including
ChildDeadline.
But when the Scheduler sees such a 'left-over' ChildDeadline field it
normally marks the VM as dirty and powers it off, thus interfering
with the script being tested.
So modify the Scheduler to ignore ChildDeadline for maintenance VMs
whether for cleanup or to compute when to reschedule next.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/WineTestBot/Engine/Scheduler.pm | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index 3ec51d242..569dff7be 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -350,8 +350,13 @@ sub _CheckAndClassifyVMs()
     }
     else
     {
-      if (defined $VM->ChildPid or defined $VM->ChildDeadline or
-          $VM->Status =~ /^(?:running|reverting|sleeping)$/)
+      if ($VM->Status eq "maintenance")
+      {
+        # Don't touch the VM while the administrator is working on it
+        $Sched->{busyvms}->{$VMKey} = 1;
+      }
+      elsif (defined $VM->ChildPid or defined $VM->ChildDeadline or
+             $VM->Status =~ /^(?:running|reverting|sleeping)$/)
       {
         # The VM is missing its child process or it died unexpectedly. Mark
         # the VM dirty so a revert or shutdown brings it back to a known state.
@@ -381,11 +386,6 @@ sub _CheckAndClassifyVMs()
         # Ignore the VM for this round since we cannot use it
         $Sched->{busyvms}->{$VMKey} = 1;
       }
-      elsif ($VM->Status eq "maintenance")
-      {
-        # Don't touch the VM while the administrator is working on it
-        $Sched->{busyvms}->{$VMKey} = 1;
-      }
       elsif ($VM->Status ne "off")
       {
         LogMsg "Unexpected $VMKey status ". $VM->Status ."\n";
@@ -1025,7 +1025,7 @@ sub ScheduleJobs()
   $VMs->FilterEnabledRole();
   foreach my $VM (@{$VMs->GetItems()})
   {
-    if (defined $VM->ChildDeadline and
+    if ($VM->Status ne "maintenance" and defined $VM->ChildDeadline and
         (!defined $FirstDeadline or $VM->ChildDeadline < $FirstDeadline))
     {
       $FirstDeadline = $VM->ChildDeadline;
-- 
2.20.1




More information about the wine-devel mailing list