The Errors field definition only allows two digits which sounds like more than enough for a count of consecutive errors but can overflow in a few days if the VM hosts are knocked out, which then causes the scripts to die. It would be easy to increase the maximum number of digits but that would only postpone the issue so add VM::AddError() to make sure the field does not overflow.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/LibvirtTool.pl | 3 +-- testbot/bin/WineRunBuild.pl | 3 +-- testbot/bin/WineRunReconfig.pl | 3 +-- testbot/bin/WineRunTask.pl | 3 +-- testbot/bin/WineRunWineTest.pl | 3 +-- testbot/lib/WineTestBot/Engine/Scheduler.pm | 6 ++---- testbot/lib/WineTestBot/VMs.pm | 9 +++++++++ 7 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/testbot/bin/LibvirtTool.pl b/testbot/bin/LibvirtTool.pl index 47839b611d..a025085d44 100755 --- a/testbot/bin/LibvirtTool.pl +++ b/testbot/bin/LibvirtTool.pl @@ -189,8 +189,7 @@ sub FatalError($) } $VM->ChildDeadline(undef); $VM->ChildPid(undef); - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + my $Errors = $VM->AddError();
my ($ErrProperty, $SaveErrMessage) = $VM->Save(); if (defined $SaveErrMessage) diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl index 8585882b7d..50696b7091 100755 --- a/testbot/bin/WineRunBuild.pl +++ b/testbot/bin/WineRunBuild.pl @@ -241,8 +241,7 @@ sub WrapUpAndExit($;$$$$) $VM->Status($NewVMStatus); if ($NewVMStatus eq 'offline') { - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + $VM->AddError(); } else { diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl index 373e657dc4..b4035cb021 100755 --- a/testbot/bin/WineRunReconfig.pl +++ b/testbot/bin/WineRunReconfig.pl @@ -243,8 +243,7 @@ sub WrapUpAndExit($;$$$$) $VM->Status($NewVMStatus); if ($NewVMStatus eq 'offline') { - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + $VM->AddError(); } else { diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl index 58e055ca8d..511bde0424 100755 --- a/testbot/bin/WineRunTask.pl +++ b/testbot/bin/WineRunTask.pl @@ -275,8 +275,7 @@ sub WrapUpAndExit($;$$$$) $VM->Status($NewVMStatus); if ($NewVMStatus eq 'offline') { - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + $VM->AddError(); } else { diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl index c9a57bb86c..c1a37aec5f 100755 --- a/testbot/bin/WineRunWineTest.pl +++ b/testbot/bin/WineRunWineTest.pl @@ -272,8 +272,7 @@ sub WrapUpAndExit($;$$$$) $VM->Status($NewVMStatus); if ($NewVMStatus eq 'offline') { - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + $VM->AddError(); } else { diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm index 800d136835..f606c0d07b 100644 --- a/testbot/lib/WineTestBot/Engine/Scheduler.pm +++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm @@ -272,8 +272,7 @@ sub _CheckAndClassifyVMs() $FoundVMErrors = 1; if ($VM->Status eq "reverting" or $VM->Status eq "sleeping") { - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + my $Errors = $VM->AddError(); $VM->Status("offline"); NotifyAdministrator("Putting the $VMKey VM offline", "The last $Errors revert operations timed out.\n\n". @@ -360,8 +359,7 @@ sub _CheckAndClassifyVMs() $FoundVMErrors = 1; $VM->ChildDeadline(undef); $VM->ChildPid(undef); - my $Errors = ($VM->Errors || 0) + 1; - $VM->Errors($Errors); + my $Errors = $VM->AddError(); if ($Errors >= $MaxVMErrors) { $VM->Status("offline"); diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm index 596499acd0..60a52b86c5 100644 --- a/testbot/lib/WineTestBot/VMs.pm +++ b/testbot/lib/WineTestBot/VMs.pm @@ -264,6 +264,15 @@ sub Status($;$) return $NewStatus; }
+sub AddError($) +{ + my ($self) = @_; + + my $Errors = ($self->Errors || 0) + 1; + $self->Errors($Errors) if ($Errors <= 99); + return $Errors; +} + =pod =over 12