Added specific exceptions for various failures in verify and changed the
code that raised them to use these new exceptions. Completely reworked
the 3 repair phases to try to fix things by handling the specific errors
generated by verify (in a loop where it exits either by not being able
to fix an issue or if the last verify ran successfully). Reorganized
some code to support this new way to repair hosts.

The code tries to remember each repair handler it used to catch the case
where even after executing the handler the same verify failure is
reported and it may execute the repair handler in an infinite loop.
When it finds out that the same repair handler has already been executed
it will re-raise the original exception hoping it will be cought in 
surrounding try/except contexts or the exception will make repair fail.

Signed-off-by: Mihai Rusu <dizzy@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3217 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index deebd2f..e3bceda 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -205,6 +205,38 @@
     pass
 
 
+class AutoservHostIsShuttingDownError(AutoservHostError):
+    """Host is shutting down"""
+    pass
+
+
+class AutoservNotMountedHostError(AutoservHostError):
+    """Found unmounted partitions that should be mounted"""
+    pass
+
+
+class AutoservSshPingHostError(AutoservHostError):
+    """SSH ping failed"""
+    pass
+
+
+class AutoservDiskFullHostError(AutoservHostError):
+    """Not enough free disk space on host"""
+    def __init__(self, path, want_gb, free_space_gb):
+        AutoservHostError.__init__(self,
+            'Not enough free space on %s - %.3fGB free, want %.3fGB' %
+            (path, free_space_gb, want_gb))
+
+        self.path = path
+        self.want_gb = want_gb
+        self.free_space_gb = free_space_gb
+
+
+class AutoservHardwareHostError(AutoservHostError):
+    """Found hardware problems with the host"""
+    pass
+
+
 class AutoservRebootError(AutoservError):
     """Error occured while rebooting a machine"""
     pass