Module: tools
Branch: master
Commit: d6523a05cd74501cab92c6451275819757b67ba1
URL: http://source.winehq.org/git/tools.git/?a=commit;h=d6523a05cd74501cab92c645…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Dec 18 23:53:51 2017 +0100
testbot: Save the status of all VMs on startup.
This allows providing more information about the initial state of the
VMs such as linking running VMs to the corresponding Task, and
identifying the initial dirty status as running '…
[View More]LibvirtTool checkidle'.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/Engine.pl | 44 ++++++++++++++++++++++++++++++++++--------
testbot/lib/WineTestBot/VMs.pm | 7 +++++++
2 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index 7dab98e..36a18ad 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -52,6 +52,7 @@ use WineTestBot::Jobs;
use WineTestBot::Log;
use WineTestBot::Patches;
use WineTestBot::PendingPatchSets;
+use WineTestBot::RecordGroups;
use WineTestBot::Utils;
use WineTestBot::VMs;
@@ -102,7 +103,7 @@ sub Cleanup($;$$)
# Verify that the running tasks are still alive and requeue them if not.
# Ignore the Job and Step status fields because they may be a bit out of date.
- my %BusyVMs;
+ my %RunningVMs;
foreach my $Job (@{CreateJobs()->GetItems()})
{
my $CallUpdateStatus;
@@ -135,7 +136,7 @@ sub Cleanup($;$$)
{
# This task is still running!
LogMsg "$TaskKey is still running\n";
- $BusyVMs{$Task->VM->GetKey()} = 1;
+ $RunningVMs{$Task->VM->GetKey()} = join(" ", "running", $Job->Id, $Step->No, $Task->No);
next;
}
if ($Requeue)
@@ -158,16 +159,27 @@ sub Cleanup($;$$)
}
# Get the VMs in order now
+ my $RecordGroups = CreateRecordGroups();
+ my $Records = $RecordGroups->Add()->Records;
+ # Save the new RecordGroup now so its Id is lower than those of the groups
+ # created by the scripts called from Cleanup().
+ $RecordGroups->Save();
+
my $VMs = CreateVMs();
- $VMs->FilterEnabledRole();
- $VMs->FilterEnabledStatus();
foreach my $VM (@{$VMs->GetItems()})
{
my $VMKey = $VM->GetKey();
- if ($BusyVMs{$VMKey})
+ if (!$VM->HasEnabledRole() or !$VM->HasEnabledStatus())
+ {
+ $VM->RecordStatus($Records);
+ next;
+ }
+
+ if ($RunningVMs{$VMKey})
{
# This VM is still running a task. Let it.
- LogMsg "$VMKey is used by a task\n";
+ LogMsg "$VMKey is $RunningVMs{$VMKey}\n";
+ $VM->RecordStatus($Records, $RunningVMs{$VMKey});
next;
}
@@ -177,27 +189,39 @@ sub Cleanup($;$$)
{
$VM->KillChild();
$VM->RunPowerOff();
+ $VM->RecordStatus($Records, "dirty poweroff (kill tasks)");
}
elsif ($KillVMs and $VM->Status ne "running")
{
$VM->KillChild();
# $KillVMs is normally used on shutdown so don't start a process that
# will get stuck 'forever' waiting for an offline VM.
- $VM->RunPowerOff() if ($VM->Status ne "offline");
+ if ($VM->Status ne "offline")
+ {
+ $VM->RunPowerOff();
+ $VM->RecordStatus($Records, "dirty poweroff (kill vms)");
+ }
}
elsif (!$VM->CanHaveChild())
{
# The VM should not have a process.
$VM->KillChild();
$VM->RunPowerOff();
+ $VM->RecordStatus($Records, "dirty poweroff (unexpected process)");
+ }
+ elsif ($Starting)
+ {
+ # Let the process finish its work. Note that on shutdown we don't
+ # record the VM status if it did not change.
+ $VM->RecordStatus($Records);
}
- # else let the process finish its work
}
elsif ($Starting)
{
if ($VM->Status eq "idle")
{
$VM->RunCheckIdle();
+ $VM->RecordStatus($Records, "dirty idle check");
}
else
{
@@ -205,6 +229,7 @@ sub Cleanup($;$$)
# This is the simplest way to resync the VM status field.
# Also powering off a powered off VM will detect offline VMs.
$VM->RunPowerOff();
+ $VM->RecordStatus($Records, "dirty poweroff");
}
}
# $KillVMs is normally used on shutdown so don't start a process that
@@ -212,8 +237,11 @@ sub Cleanup($;$$)
elsif ($KillVMs and $VM->Status !~ /^(?:off|offline)$/)
{
$VM->RunPowerOff();
+ $VM->RecordStatus($Records, "dirty poweroff (kill vms)");
}
+ # Note that on shutdown we don't record the VM status if it did not change.
}
+ $RecordGroups->Save();
}
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index a8da842..961be52 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -183,6 +183,13 @@ sub HasEnabledRole($)
return $self->Role ne "retired" && $self->Role ne "deleted";
}
+sub HasEnabledStatus($)
+{
+ my ($self) = @_;
+ # Filter out the maintenance VMs
+ return $self->Status ne "maintenance";
+}
+
sub GetHost($)
{
my ($self) = @_;
[View Less]
Module: tools
Branch: master
Commit: 463e3cd3ac7c5dd5bf1355b081d9f202f71dc3c7
URL: http://source.winehq.org/git/tools.git/?a=commit;h=463e3cd3ac7c5dd5bf1355b0…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Dec 18 23:53:47 2017 +0100
testbot: Keep a record of the status of the VMs.
Each row of the new Records table allows storing part of the details
of an event or of the state of the TestBot. These pieces of information
are put together into groups and timestamped …
[View More]through the RecordGroups
table. Together these tables allow rebuilding the activity of the
TestBot.
The first user of these new tables is the job scheduler which uses them
to store the new VM status if it changed. This will allow rebuilding
and visualizing the activity of the TestBot for monitoring or debugging.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/Janitor.pl | 21 ++
testbot/ddl/update29.sql | 20 ++
testbot/ddl/winetestbot.sql | 19 ++
testbot/doc/winetestbot-schema.dia | 338 ++++++++++++++++++++++++++++++++
testbot/lib/WineTestBot/Jobs.pm | 64 +++++-
testbot/lib/WineTestBot/RecordGroups.pm | 117 +++++++++++
testbot/lib/WineTestBot/Records.pm | 126 ++++++++++++
testbot/lib/WineTestBot/VMs.pm | 60 ++++++
8 files changed, 760 insertions(+), 5 deletions(-)
Diff: http://source.winehq.org/git/tools.git/?a=commitdiff;h=463e3cd3ac7c5dd5bf13…
[View Less]