Make the servo object a property of the host.

This adds a 'servo' member to instances of SiteHost, when the
target hostname has an associated "-servo" hostname as well.

Additionally, in order to support run_remote_tests, an optional
parameter to the host initialize() method can be used to specify
that servod should be started on the local host if no "-servo"
host can be found.

Not all test control files are updated to use the new scheme,
so class ServoTest retains the ability to create and start
servod itself, when necessary.

BUG=chromium-os:29209
TEST=run all the changed tests using a locally attached Servo
TEST=same test with servo debug header detached to force failure

Change-Id: Ibbd521ee5f90450fd5fa30629a020ba3fd45937d
Reviewed-on: https://gerrit.chromium.org/gerrit/20657
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
diff --git a/server/cros/servo.py b/server/cros/servo.py
index daf0c05..a8d6220 100644
--- a/server/cros/servo.py
+++ b/server/cros/servo.py
@@ -48,21 +48,36 @@
                'unused': ['1', '0'], 'none': ['1', '1']}
         }
 
+
     @staticmethod
-    def create_simple(device_under_test_hostname):
-        """Instantiate a Servo for |device_under_test_hostname| in the lab.
+    def _make_servo_hostname(hostname):
+        host_parts = hostname.split('.')
+        host_parts[0] = host_parts[0] + '-servo'
+        return '.'.join(host_parts)
 
-        Assuming that |device_under_test_hostname| is a device in the CrOS
-        test lab, create and return a Servo object pointed at the
-        servo attached to that DUT.  The servo in the test lab is assumed to
-        already have servod up and running on it.
+    @staticmethod
+    def get_lab_servo(target_hostname):
+        """Instantiate a Servo for |target_hostname| in the lab.
 
-        @param device_under_test_hostname: device whose servo we want to target.
+        Assuming that |target_hostname| is a device in the CrOS test
+        lab, create and return a Servo object pointed at the servo
+        attached to that DUT.  The servo in the test lab is assumed
+        to already have servod up and running on it.
+
+        @param target_hostname: device whose servo we want to target.
         @return an appropriately configured Servo
         """
-        host_parts = device_under_test_hostname.split('.')
-        host_parts[0] = host_parts[0] + '-servo'
-        return Servo(servo_host='.'.join(host_parts))
+        servo_host = Servo._make_servo_hostname(target_hostname)
+        if utils.host_is_in_lab_zone(servo_host):
+          try:
+              return Servo(servo_host=servo_host)
+          except:
+              # TODO(jrbarnette):  Long-term, if we can't get to
+              # a servo in the lab, we want to fail, so we should
+              # pass any exceptions along.  Short-term, we're not
+              # ready to rely on servo, so we ignore failures.
+              pass
+        return None
 
 
     def __init__(self, servo_host=None, servo_port=9999,