[2/4] testbot/lib: Simplify Jobs::ScheduleOnHost() a bit.
Francois Gouget
fgouget at codeweavers.com
Mon Jan 21 21:10:41 CST 2013
---
Conceptually this is independent from the other patches in the series
(especially 1/4) but I just want to avoid conflicts.
testbot/lib/WineTestBot/Jobs.pm | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index c15c7af..269643d 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -388,16 +388,16 @@ sub ScheduleOnHost($$)
my @SortedTasks = sort CompareTaskStatus @{$Tasks->GetItems()};
foreach my $Task (@SortedTasks)
{
- if ($Task->Status eq "queued" &&
- $HostVMs->ItemExists($Task->VM->GetKey()))
+ my $VM = $Task->VM;
+ my $VMKey = $VM->GetKey();
+ if ($Task->Status eq "queued" && $HostVMs->ItemExists($VMKey))
{
- my $VM = $HostVMs->GetItem($Task->VM->GetKey());
if ($VM->Status eq "idle" &&
$RunningVMs < $MaxRunningVMs &&
$RevertingVMs == 0)
{
$VM->Status("running");
- my ($ErrProperty, $ErrMessage) = $HostVMs->Save();
+ my ($ErrProperty, $ErrMessage) = $VM->Save();
if (defined($ErrMessage))
{
return $ErrMessage;
@@ -407,12 +407,11 @@ sub ScheduleOnHost($$)
{
return $ErrMessage;
}
- $Job->UpdateStatus;
+ $Job->UpdateStatus();
$RunningVMs++;
}
elsif ($VM->Status eq "dirty")
{
- my $VMKey = $VM->GetKey();
if (! defined($DirtyVMsBlockingJobs{$VMKey}) ||
$Job->Priority < $DirtyVMsBlockingJobs{$VMKey})
{
--
1.7.10.4
More information about the wine-patches
mailing list