Share SSH Master connection across control scripts.

BUG=chromium:726481
TEST=test_that locally. Ran trybots.

Change-Id: I39993f9179aa50690e987f5d2d34892cbe00ee44
Reviewed-on: https://chromium-review.googlesource.com/547077
Commit-Ready: Hidehiko Abe <hidehiko@chromium.org>
Tested-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/site_utils.py b/server/site_utils.py
index a99bbb6..4e8626f 100644
--- a/server/site_utils.py
+++ b/server/site_utils.py
@@ -725,6 +725,13 @@
     return afe_host
 
 
+def get_connection_pool_from_machine(machine):
+    """Returns the ssh_multiplex.ConnectionPool from machine if possible."""
+    if not isinstance(machine, dict):
+        return None
+    return machine.get('connection_pool')
+
+
 def get_creds_abspath(creds_file):
     """Returns the abspath of the credentials file.
 
@@ -839,6 +846,8 @@
 
     @param duts: List of duts to lock.
     @param afe: afe instance.
+    @param lock_msg: message for afe on locking this host.
+    @param max_wait: Max wait time in seconds.
 
     @returns Boolean lock_success where True if all duts locked successfully or
              False if we timed out waiting too long for hosts to go idle.