[autotest] Fix is_available()

So there are many different kinds of Host objects, and I put this
method on the wrong one.  Both of these are from AFE RPC calls and
thus use the RPC return Host object, not the Django database Host
object or the scheduler database Host object, or any of the two other
types of Hosts.

BUG=chromium:787233
TEST=None

Change-Id: I1ce07b2b827fde301707b14d85e658ce2f4c427f
Reviewed-on: https://chromium-review.googlesource.com/780844
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Ningning Xia <nxia@chromium.org>
diff --git a/server/frontend.py b/server/frontend.py
index 3c143ab..bfcba8f 100644
--- a/server/frontend.py
+++ b/server/frontend.py
@@ -24,6 +24,7 @@
 from autotest_lib.frontend.afe import rpc_client_lib
 from autotest_lib.client.common_lib import control_data
 from autotest_lib.client.common_lib import global_config
+from autotest_lib.client.common_lib import host_states
 from autotest_lib.client.common_lib import priorities
 from autotest_lib.client.common_lib import utils
 from autotest_lib.tko import db
@@ -949,6 +950,15 @@
         return self.afe.run('host_remove_labels', id=self.id, labels=labels)
 
 
+    def is_available(self):
+        """Check whether DUT host is available.
+
+        @return: bool
+        """
+        return not (self.locked
+                    or self.status in host_states.UNAVAILABLE_STATES)
+
+
 class User(RpcObject):
     def __repr__(self):
         return 'USER: %s' % self.login