Module: tools Branch: master Commit: e01735f547e5af2492742217cc1feb9f44155fa7 URL: http://source.winehq.org/git/tools.git/?a=commit;h=e01735f547e5af2492742217c...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Oct 23 16:06:12 2017 +0200
testbot: Validate and adjust the VM limits on startup.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/bin/Engine.pl | 15 +++++++++++++++ testbot/lib/WineTestBot/Jobs.pm | 5 ++--- 2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index fe16f17..4840449 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -700,6 +700,21 @@ sub main() $WineTestBot::Engine::Notify::RunningInEngine = 1; LogMsg "Starting the WineTestBot Engine\n";
+ # Validate and adjust the configuration options + $MaxActiveVMs ||= 1; + $MaxRevertingVMs ||= $MaxActiveVMs; + if ($MaxRevertingVMs > $MaxActiveVMs) + { + $MaxRevertingVMs = $MaxActiveVMs; + LogMsg "Capping MaxRevertingVMs to MaxActiveVMs ($MaxRevertingVMs)\n"; + } + $MaxRevertsWhileRunningVMs ||= 0; + if ($MaxRevertsWhileRunningVMs > $MaxRevertingVMs) + { + $MaxRevertsWhileRunningVMs = $MaxRevertingVMs; + LogMsg "Capping MaxRevertsWhileRunningVMs to MaxRevertingVMs ($MaxRevertsWhileRunningVMs)\n"; + } + $MaxVMsWhenIdle ||= $MaxActiveVMs; Cleanup();
# Check for patches that arrived while the server was off. diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm index 3a3e517..3c7ce0d 100644 --- a/testbot/lib/WineTestBot/Jobs.pm +++ b/testbot/lib/WineTestBot/Jobs.pm @@ -691,15 +691,14 @@ sub ScheduleOnHost($$$) }
# Finally, if we are otherwise idle, prepare some VMs for future jobs - my $MaxIdleVMs = defined $MaxVMsWhenIdle ? $MaxVMsWhenIdle : $MaxActiveVMs; - if ($ActiveCount - $IdleCount == 0 && $ActiveCount < $MaxIdleVMs) + if ($ActiveCount == $IdleCount && $ActiveCount < $MaxVMsWhenIdle) { # Sort from most important to least important my @SortedVMs = sort { $VMPriorities{$b} <=> $VMPriorities{$a} } keys %VMPriorities; foreach my $VMKey (@SortedVMs) { last if ($RevertingCount == $MaxReverts); - last if ($ActiveCount >= $MaxIdleVMs); + last if ($ActiveCount >= $MaxVMsWhenIdle);
my $VM = $HostVMs->GetItem($VMKey); next if ($VM->Status ne "off");