[autotest] add ssh_verbosity to test_that and autoserv_utils

BUG=chromium:271621
TEST=unit tests pass. Manually verified that flag works as expected.

Change-Id: I31c59a80a7a2151c27d4a41ff8c6cfbf51d259cb
Reviewed-on: https://gerrit.chromium.org/gerrit/65720
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/server/autoserv_utils.py b/server/autoserv_utils.py
index 90c6f6f..9ad2d05 100644
--- a/server/autoserv_utils.py
+++ b/server/autoserv_utils.py
@@ -12,7 +12,8 @@
 def autoserv_run_job_command(autoserv_directory, machines,
                              results_directory=None, extra_args=[], job=None,
                              queue_entry=None, verbose=True,
-                             write_pidfile=True, fast_mode=False):
+                             write_pidfile=True, fast_mode=False,
+                             ssh_verbosity=0):
     """
     Construct an autoserv command from a job or host queue entry.
 
@@ -33,6 +34,8 @@
     @param write_pidfile: Boolean (default: True) for whether autoserv should
                           write a pidfile.
     @param fast_mode: bool to use fast mode (disables slow autotest features).
+    @param ssh_verbosity: integer between 0 and 3 (inclusive) which sents the
+                          verbosity level of ssh. Default: 0.
     @returns The autoserv command line as a list of executable + parameters.
     """
     command = [os.path.join(autoserv_directory, 'autoserv')]
@@ -46,6 +49,9 @@
     if machines:
         command += ['-m', machines]
 
+    if ssh_verbosity:
+        command += ['--ssh_verbosity', str(ssh_verbosity)]
+
     if job or queue_entry:
         if not job:
             job = queue_entry.job