[Tools] testbot: Validate and adjust the VM limits on startup.
Francois Gouget
fgouget at codeweavers.com
Mon Oct 23 09:06:12 CDT 2017
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
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 fe16f178..9b497023 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 3a3e5177..3c7ce0df 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");
--
2.14.2
More information about the wine-patches
mailing list