Currently if a host is down or doesn't have an accessible sshd attempts
to execute tests on the client fail.  This causes entire queues of tests
to fail when a single bad kernel is run.  This blocks tests from
starting if the machine isn't in a good state.  More pixie dust can
probably be added to this to make it smarter, but this at least prevents
cacading failures.

Signed-off-by: Ryan Stutsman <stutsman@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@594 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index b5a24df..f2eb297 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -285,6 +285,14 @@
 		
 		return False
 	
+	def ensure_up(self):
+		"""Ensure the host is up if it is not then do not proceed;
+		this prevents cacading failures of tests"""
+		if not self.wait_up(300) and hasattr(self, 'hardreset'):
+			print "Performing a hardreset on %s" % self.hostname
+			self.hardreset()
+		self.wait_up()
+	
 	def get_num_cpu(self):
 		"""Get the number of CPUs in the host according to 
 		/proc/cpuinfo.