Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/web/index.pl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/testbot/web/index.pl b/testbot/web/index.pl index 21ee5fea4..1083d3b57 100644 --- a/testbot/web/index.pl +++ b/testbot/web/index.pl @@ -264,14 +264,15 @@ sub GenerateBody($) print "<div class='GeneralStatusItemText'><a href='#jobs'>Engine appears to be dead and is not processing jobs</a></div>"; } print "</div>\n"; - - my $OfflineVMs = CreateVMs(); - $OfflineVMs->FilterEnabledRole(); - $OfflineVMs->AddFilter("Status", ["offline"]); - my $MaintenanceVMs = CreateVMs(); - $MaintenanceVMs->FilterEnabledRole(); - $MaintenanceVMs->AddFilter("Status", ["maintenance"]); - if ($OfflineVMs->IsEmpty() and $MaintenanceVMs->IsEmpty()) + + my $VMs = CreateVMs(); + my ($OfflineVMs, $MaintenanceVMs); + foreach my $VM (@{$VMs->GetItems()}) + { + $OfflineVMs++ if ($VM->Status eq "offline"); + $MaintenanceVMs++ if ($VM->Status eq "maintenance"); + } + if (!$OfflineVMs and !$MaintenanceVMs) { print "<div class='GeneralStatusItem'>"; $self->OutputDot("green"); @@ -280,18 +281,18 @@ sub GenerateBody($) } else { - if (!$OfflineVMs->IsEmpty()) + if ($OfflineVMs) { print "<div class='GeneralStatusItem'>"; $self->OutputDot("red"); - print "<div class='GeneralStatusItemText'><a href='#vms'>One or more VMs are offline</a></div>"; + print "<div class='GeneralStatusItemText'><a href='#vms'>$OfflineVMs VMs are offline</a></div>"; print "</div>\n"; } - if (!$MaintenanceVMs->IsEmpty()) + if ($MaintenanceVMs) { print "<div class='GeneralStatusItem'>"; $self->OutputDot("red"); - print "<div class='GeneralStatusItemText'><a href='#vms'>One or more VMs are undergoing maintenance</a></div>"; + print "<div class='GeneralStatusItemText'><a href='#vms'>$MaintenanceVMs VMs are undergoing maintenance</a></div>"; print "</div>\n"; } } @@ -343,7 +344,7 @@ sub GenerateBody($) EOF
print "<h2><a name='vms'></a>VMs</h2>\n"; - my $VMsCollectionBlock = new VMStatusBlock(CreateVMs(), $self); + my $VMsCollectionBlock = new VMStatusBlock($VMs, $self); $VMsCollectionBlock->SetReadWrite(0); $VMsCollectionBlock->GenerateList(); print "</div>\n";