Francois Gouget : testbot/VMs: Add a maintenance status for VMs.

Alexandre Julliard julliard at winehq.org
Wed Mar 27 13:09:01 CDT 2013


Module: tools
Branch: master
Commit: 89ec21a5445fde7d66000371d3b725d0bee8ee42
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=89ec21a5445fde7d66000371d3b725d0bee8ee42

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Mar 27 11:13:35 2013 +0100

testbot/VMs: Add a maintenance status for VMs.

This makes it possible to distinguish between broken (offline) VMs,
and VMs the administrator is reconfiguring.

---

 testbot/ddl/update22.sql       |    4 ++++
 testbot/ddl/winetestbot.sql    |    2 +-
 testbot/lib/WineTestBot/VMs.pm |   10 ++++++++--
 testbot/web/Submit.pl          |    8 ++++++--
 testbot/web/index.pl           |   31 +++++++++++++++++++++++--------
 5 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/testbot/ddl/update22.sql b/testbot/ddl/update22.sql
new file mode 100644
index 0000000..cd4f5a2
--- /dev/null
+++ b/testbot/ddl/update22.sql
@@ -0,0 +1,4 @@
+USE winetestbot;
+
+ALTER TABLE VMs
+  MODIFY Status ENUM('dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline', 'maintenance') NOT NULL;
diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql
index 4763d86..4912a59 100644
--- a/testbot/ddl/winetestbot.sql
+++ b/testbot/ddl/winetestbot.sql
@@ -48,7 +48,7 @@ CREATE TABLE VMs
   SortOrder    INT(3)           NOT NULL,
   Type         ENUM('win32', 'win64', 'build') NOT NULL,
   Role         ENUM('extra', 'base', 'winetest', 'retired', 'deleted') NOT NULL,
-  Status       ENUM('dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline') NOT NULL,
+  Status       ENUM('dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline', 'maintenance') NOT NULL,
   ChildPid     INT(5)           NULL,
   VirtURI      VARCHAR(64)      NOT NULL,
   VirtDomain   VARCHAR(32)      NOT NULL,
diff --git a/testbot/lib/WineTestBot/VMs.pm b/testbot/lib/WineTestBot/VMs.pm
index 826b0f6..04aeb3c 100644
--- a/testbot/lib/WineTestBot/VMs.pm
+++ b/testbot/lib/WineTestBot/VMs.pm
@@ -185,6 +185,12 @@ responding anymore), making it temporarily unusable. New jobs can still be
 added for this VM but they won't be run until an administrator fixes it.
 The main web status page has a warning indicator on when some VMs are offline.
 
+=item maintenance
+
+A WineTestBot administrator is working on the VM so that it cannot be used for
+the tests. The main web status page has a warning indicator on when some VMs
+are undergoing maintenance.
+
 =back
 
 =cut
@@ -572,7 +578,7 @@ BEGIN
     CreateBasicPropertyDescriptor("SortOrder", "Display order", !1, 1, "N", 3),
     CreateEnumPropertyDescriptor("Type", "Type of VM", !1, 1, ['win32', 'win64', 'build']),
     CreateEnumPropertyDescriptor("Role", "VM Role", !1, 1, ['extra', 'base', 'winetest', 'retired', 'deleted']),
-    CreateEnumPropertyDescriptor("Status", "Current status", !1, 1, ['dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline']),
+    CreateEnumPropertyDescriptor("Status", "Current status", !1, 1, ['dirty', 'reverting', 'sleeping', 'idle', 'running', 'offline', 'maintenance']),
     # Note: ChildPid is only valid when Status == 'reverting' or 'sleeping'.
     CreateBasicPropertyDescriptor("ChildPid", "Child process id", !1, !1, "N", 5),
     CreateBasicPropertyDescriptor("VirtURI", "LibVirt URI of the VM", !1, 1, "A", 64),
@@ -668,7 +674,7 @@ sub FilterEnabledRole($)
 sub FilterEnabledStatus($)
 {
   my ($self) = @_;
-  # Filter out the disabled VMs, that is the offline ones
+  # Filter out the disabled VMs, that is the offline and maintenance ones
   $self->AddFilter("Status", ["dirty", "reverting", "sleeping", "idle", "running"]);
 }
 
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 88a27dc..1288bf0 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -83,10 +83,10 @@ sub GetHeaderText
   {
     my $HeaderText = "Select the VMs on which you want to run your test.";
     my $VMs = CreateVMs();
-    $VMs->AddFilter("Status", ["offline"]);
+    $VMs->AddFilter("Status", ["offline", "maintenance"]);
     if (!$VMs->IsEmpty())
     {
-      $HeaderText .= "<br>NOTE: Offline VMs will not be able to run your tests right away.";
+      $HeaderText .= "<br>NOTE: Offline VMs and those undergoing maintenance will not be able to run your tests right away.";
     }
     return $HeaderText;
   }
@@ -260,6 +260,10 @@ sub GenerateFields
         {
           print " [offline]";
         }
+        elsif ($VM->Status eq 'maintenance')
+        {
+          print " [maintenance]";
+        }
         print "</label><div class='ItemValue'><input type='checkbox' name='$FieldName'";
         if ($self->GetParam("Page") == 1 || $self->GetParam($FieldName))
         {
diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index 94d8254..1dffaf7 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -234,22 +234,37 @@ sub GenerateBody
   }
   print "</div>\n";
   
-  print "<div class='GeneralStatusItem'>";
-  my $VMs = CreateVMs();
-  $VMs->FilterEnabledRole();
-  $VMs->AddFilter("Status", ["offline"]);
-  if ($VMs->IsEmpty())
+  my $OfflineVMs = CreateVMs();
+  $OfflineVMs->FilterEnabledRole();
+  $OfflineVMs->AddFilter("Status", ["offline"]);
+  my $MaintenanceVMs = CreateVMs();
+  $MaintenanceVMs->FilterEnabledRole();
+  $MaintenanceVMs->AddFilter("Status", ["maintenance"]);
+  if ($OfflineVMs->IsEmpty() and $MaintenanceVMs->IsEmpty())
   {
+    print "<div class='GeneralStatusItem'>";
     $self->OutputDot("green");
     print "<div class='GeneralStatusItemText'><a href='#vms'>All VMs are online</a></div>";
+    print "</div>\n";
   }
   else
   {
-    $self->OutputDot("red");
-    print "<div class='GeneralStatusItemText'><a href='#vms'>One or more VMs are offline</a></div>";
+    if (!$OfflineVMs->IsEmpty())
+    {
+      print "<div class='GeneralStatusItem'>";
+      $self->OutputDot("red");
+      print "<div class='GeneralStatusItemText'><a href='#vms'>One or more VMs are offline</a></div>";
+      print "</div>\n";
+    }
+    if (!$MaintenanceVMs->IsEmpty())
+    {
+      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>\n";
+    }
   }
   print "</div>\n";
-  print "</div>\n";
 
   print "<h2><a name='jobs'></a>Jobs</h2>\n";
   my $Jobs = CreateJobs();




More information about the wine-cvs mailing list