[autotest] Rename site_host.SiteHost to cros_host.CrosHost

Rename site_host.SiteHost to cros_host.CrosHost.
cros_host.CrosHost is the new chromeos specific host class.
The concept 'SiteHost' is deprecated as we are dealing with
multiple types of hosts (e.g. ServoHost).
The concept of a single'SiteHost' doesn't meet our needs any more.

All references are updated.

SerialHost is now subclassing RemoteHost and mixes in CrosHost
in hosts.factory.create_host().

BUG=chromium:273833
TEST=Trybot build passes; Repair/Verify pass;
Dummy suite passes;
Server side test platform_InstallTestImage
which is affected by this CL passes.
DEPLOY=scheduler

Change-Id: I5e59194996c67c6b5d7fdcaf40d594ea08de1af5
Reviewed-on: https://chromium-review.googlesource.com/167182
Tested-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Fang Deng <fdeng@chromium.org>
diff --git a/server/hosts/__init__.py b/server/hosts/__init__.py
index 2d90332..392b110 100644
--- a/server/hosts/__init__.py
+++ b/server/hosts/__init__.py
@@ -11,15 +11,12 @@
 # host abstract classes
 from base_classes import Host
 from remote import RemoteHost
-try:
-    from site_host import SiteHost
-except ImportError, e:
-    pass
 
 # host implementation classes
 from ssh_host import SSHHost
 from guest import Guest
 from kvm_guest import KVMGuest
+from cros_host import CrosHost
 
 # extra logger classes
 from serial import SerialHost
diff --git a/server/hosts/base_classes.py b/server/hosts/base_classes.py
index 5316865..0759d5f 100644
--- a/server/hosts/base_classes.py
+++ b/server/hosts/base_classes.py
@@ -78,9 +78,3 @@
 
         if self.job:
             self.job.hosts.discard(self)
-
-
-    @staticmethod
-    def check_for_rpm_support(hostname):
-        """Stub method. RPM support is implemented in site_host."""
-        return False
\ No newline at end of file
diff --git a/server/hosts/site_host.py b/server/hosts/cros_host.py
similarity index 99%
rename from server/hosts/site_host.py
rename to server/hosts/cros_host.py
index 3c09b1f..469e673 100644
--- a/server/hosts/site_host.py
+++ b/server/hosts/cros_host.py
@@ -87,7 +87,7 @@
     return add_func
 
 
-class SiteHost(abstract_ssh.AbstractSSHHost):
+class CrosHost(abstract_ssh.AbstractSSHHost):
     """Chromium OS specific subclass of Host."""
 
     _parser = autoserv_parser.autoserv_parser
@@ -193,7 +193,7 @@
         Recommended usage:
         ~~~~~~~~
             args_dict = utils.args_to_dict(args)
-            servo_args = hosts.SiteHost.get_servo_arguments(args_dict)
+            servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
             host = hosts.create_host(machine, servo_args=servo_args)
         ~~~~~~~~
 
@@ -221,7 +221,7 @@
         cases apply, `self.servo` will be `None`.
 
         """
-        super(SiteHost, self)._initialize(hostname=hostname,
+        super(CrosHost, self)._initialize(hostname=hostname,
                                           *args, **dargs)
         # self.env is a dictionary of environment variable settings
         # to be exported for commands run on the host.
@@ -885,7 +885,7 @@
 
     def close(self):
         self.rpc_disconnect_all()
-        super(SiteHost, self).close()
+        super(CrosHost, self).close()
 
 
     def _cleanup_poweron(self):
@@ -921,7 +921,7 @@
             logging.warn('Unable to restart ui, rebooting device.')
             # Since restarting the UI fails fall back to normal Autotest
             # cleanup routines, i.e. reboot the machine.
-            super(SiteHost, self).cleanup()
+            super(CrosHost, self).cleanup()
         # Check if the rpm outlet was manipulated.
         if self.has_power():
             self._cleanup_poweron()
@@ -941,7 +941,7 @@
         # Enable fastsync to avoid running extra sync commands before reboot.
         if 'fastsync' not in dargs:
             dargs['fastsync'] = True
-        super(SiteHost, self).reboot(**dargs)
+        super(CrosHost, self).reboot(**dargs)
 
 
     def verify_software(self):
@@ -955,7 +955,7 @@
          4. update_engine answers a simple status request over DBus.
 
         """
-        super(SiteHost, self).verify_software()
+        super(CrosHost, self).verify_software()
         self.check_diskspace(
             '/mnt/stateful_partition',
             global_config.global_config.get_config_value(
@@ -1436,7 +1436,7 @@
                 for RPM powered DUT's in the lab. If it does follow the format,
                 it returns a regular expression MatchObject instead.
         """
-        return re.match(SiteHost._RPM_HOSTNAME_REGEX, hostname)
+        return re.match(CrosHost._RPM_HOSTNAME_REGEX, hostname)
 
 
     def has_power(self):
@@ -1445,7 +1445,7 @@
         @return True if this host is in the CROS lab and follows the defined
                 naming format.
         """
-        return SiteHost.check_for_rpm_support(self.hostname)
+        return CrosHost.check_for_rpm_support(self.hostname)
 
 
     def _set_power(self, state, power_method):
diff --git a/server/hosts/factory.py b/server/hosts/factory.py
index 6c81618..af25cd1 100644
--- a/server/hosts/factory.py
+++ b/server/hosts/factory.py
@@ -3,7 +3,7 @@
 
 from autotest_lib.client.common_lib import error, global_config
 from autotest_lib.server import autotest, utils as server_utils
-from autotest_lib.server.hosts import site_factory, site_host, ssh_host, serial
+from autotest_lib.server.hosts import site_factory, cros_host, ssh_host, serial
 from autotest_lib.server.hosts import logfile_monitor
 
 
@@ -45,7 +45,7 @@
 
     # TODO(fdeng): this method should should dynamically discover
     # and allocate host types, crbug.com/273843
-    classes = [site_host.SiteHost]
+    classes = [cros_host.CrosHost]
     # by default assume we're using SSH support
     if SSH_ENGINE == 'paramiko':
         from autotest_lib.server.hosts import paramiko_host
diff --git a/server/hosts/remote.py b/server/hosts/remote.py
index d1b4b46..e2ddba5 100644
--- a/server/hosts/remote.py
+++ b/server/hosts/remote.py
@@ -1,5 +1,4 @@
-"""This class defines the Remote host class, mixing in the SiteHost class
-if it is available."""
+"""This class defines the Remote host class."""
 
 import os, logging, urllib
 from autotest_lib.client.common_lib import error
diff --git a/server/hosts/serial.py b/server/hosts/serial.py
index e89bff9..007e0ca 100644
--- a/server/hosts/serial.py
+++ b/server/hosts/serial.py
@@ -2,6 +2,7 @@
 
 from autotest_lib.client.common_lib import global_config, utils, error
 from autotest_lib.server import utils as server_utils
+from autotest_lib.server.hosts import cros_host
 from autotest_lib.server.hosts import remote
 
 
@@ -9,13 +10,8 @@
         'rpm_frontend_uri', type=str, default='')
 
 
-SiteHost = utils.import_site_class(
-    __file__, "autotest_lib.server.hosts.site_host", "SiteHost",
-    remote.RemoteHost)
-
-
-class SerialHost(SiteHost):
-    DEFAULT_REBOOT_TIMEOUT = SiteHost.DEFAULT_REBOOT_TIMEOUT
+class SerialHost(remote.RemoteHost):
+    DEFAULT_REBOOT_TIMEOUT = remote.RemoteHost.DEFAULT_REBOOT_TIMEOUT
     HARD_RESET_CMD = 'hardreset'
 
 
@@ -70,7 +66,8 @@
             logging.warning("Timed out while trying to attach to conmux")
             return_value = False
 
-        return return_value or SiteHost.check_for_rpm_support(hostname)
+        return (return_value or
+                cros_host.CrosHost.check_for_rpm_support(hostname))
 
 
     def start_loggers(self):