Autotest: Catch drone initialization failures.
If the drone fails initialization (i.e. its disk is completely full),
this will cause the scheduler to not start with the other remaining
drones and will put the lab in a failure loop.
This change catches the AutoservRunError and continues on with the
remaining drones.
BUG=chromium-os:36998
TEST=Checked that the scheduler starts properly when there is no problem.
Change-Id: I3863ed75cac5cdbbdc5fe7e9ee2583d93f94c109
Reviewed-on: https://gerrit.chromium.org/gerrit/40472
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/scheduler/site_drone_manager.py b/scheduler/site_drone_manager.py
index 50a63bc..3035416 100644
--- a/scheduler/site_drone_manager.py
+++ b/scheduler/site_drone_manager.py
@@ -4,7 +4,7 @@
import logging
from autotest_lib.client.common_lib import global_config
-from autotest_lib.scheduler import scheduler_config
+from autotest_lib.scheduler import drones, scheduler_config
HOSTS_JOB_SUBDIR = 'hosts/'
PARSE_LOG = '.parse.log'
@@ -47,4 +47,25 @@
"""
logging.info('killing %s', process)
drone = self._get_drone_for_process(process)
- drone.queue_kill_process(process)
\ No newline at end of file
+ drone.queue_kill_process(process)
+
+
+ def _add_drone(self, hostname):
+ """
+ Forked from drone_manager.py
+
+ Catches AutoservRunError if the drone fails initialization and does not
+ add it to the list of usable drones.
+
+ @param hostname: Hostname of the drone we are trying to add.
+ """
+ logging.info('Adding drone %s' % hostname)
+ drone = drones.get_drone(hostname)
+ if drone:
+ try:
+ drone.call('initialize', self.absolute_path(''))
+ except error.AutoservRunError as e:
+ logging.error('Failed to initialize drone %s with error: %s',
+ hostname, e)
+ return
+ self._drones[drone.hostname] = drone
\ No newline at end of file