Permalink
Browse files

Testing that we can access the drone before adding it

Signed-off-by: Jean-Marc Eurin <jmeurin@google.com>


git-svn-id: svn://test.kernel.org/autotest/trunk@4909 592f7852-d20e-0410-864c-8624ca9c26a4
  • Loading branch information...
1 parent c04a30b commit bedeb75084fadd5a4b8525231c3166584007d3eb lmr committed Nov 8, 2010
Showing with 16 additions and 5 deletions.
  1. +4 −4 scheduler/drone_manager.py
  2. +12 −1 scheduler/drones.py
@@ -159,8 +159,7 @@ def initialize(self, base_results_dir, drone_hostnames,
self._results_dir = base_results_dir
for hostname in drone_hostnames:
- drone = self._add_drone(hostname)
- drone.call('initialize', self.absolute_path(''))
+ self._add_drone(hostname)
if not self._drones:
# all drones failed to initialize
@@ -205,8 +204,9 @@ def _get_max_pidfile_refreshes(self):
def _add_drone(self, hostname):
logging.info('Adding drone %s' % hostname)
drone = drones.get_drone(hostname)
- self._drones[drone.hostname] = drone
- return drone
+ if drone:
+ self._drones[drone.hostname] = drone
+ drone.call('initialize', self.absolute_path(''))
def _remove_drone(self, hostname):
View
@@ -7,6 +7,11 @@
AUTOTEST_INSTALL_DIR = global_config.global_config.get_config_value('SCHEDULER',
'drone_installation_directory')
+class DroneUnreachable(Exception):
+ """The drone is non-sshable."""
+ pass
+
+
class _AbstractDrone(object):
"""
Attributes:
@@ -111,6 +116,9 @@ def __init__(self, hostname):
super(_RemoteDrone, self).__init__()
self.hostname = hostname
self._host = drone_utility.create_host(hostname)
+ if not self._host.is_up():
+ logging.error('Drone %s is unpingable, kicking out', hostname)
+ raise DroneUnreachable
self._autotest_install_dir = AUTOTEST_INSTALL_DIR
@@ -156,4 +164,7 @@ def get_drone(hostname):
"""
if hostname == 'localhost':
return _LocalDrone()
- return _RemoteDrone(hostname)
+ try:
+ return _RemoteDrone(hostname)
+ except DroneUnreachable:
+ return None

0 comments on commit bedeb75

Please sign in to comment.