Add capability to "phase out" drones.  You can disable a drone in the global config using "<drone hostname>_disabled: 1".  Then, from the scheduler web interface, you can reload the config, causing the scheduler to stop scheduling new jobs on the drone but to see all existing jobs to completion.  This allows us to safely remove drones from the system without any loss of work.

Also moves some initialization lines in monitor_db.main() inside the try-except, so that exceptions there will be reported via email and the status server will still be shut down.

Signed-off-by: Steve Howard <showard@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2624 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/status_server.py b/scheduler/status_server.py
index b8832f0..3d1c103 100644
--- a/scheduler/status_server.py
+++ b/scheduler/status_server.py
@@ -49,10 +49,25 @@
         self._write_line()
 
 
+    def _write_drone(self, hostname):
+        line = hostname
+        if not self.server._drone_manager.is_drone_enabled(hostname):
+            line += ' (disabled)'
+        self._write_line(line)
+
+
+    def _write_drone_list(self):
+        self._write_line('Drones:')
+        for hostname in self.server._drone_manager.drone_hostnames():
+            self._write_drone(hostname)
+        self._write_line()
+
+
     def _execute_actions(self, arguments):
         if 'reparse_config' in arguments:
             scheduler_config.config.read_config()
-            self._write_line('Updated config!')
+            self.server._drone_manager.refresh_disabled_drones()
+            self._write_line('Reparsed config!')
         self._write_line()
 
 
@@ -63,17 +78,19 @@
         arguments = self._parse_arguments()
         self._execute_actions(arguments)
         self._write_all_fields()
+        self._write_drone_list()
 
         self.wfile.write(_FOOTER)
 
 
 class StatusServer(BaseHTTPServer.HTTPServer):
-    def __init__(self):
+    def __init__(self, drone_manager):
         address = ('', _PORT)
         # HTTPServer is an old-style class :(
         BaseHTTPServer.HTTPServer.__init__(self, address,
                                            StatusServerRequestHandler)
         self._shutting_down = False
+        self._drone_manager = drone_manager
 
 
     def shutdown(self):