From 77bb7bf58240abc5b3d77ba206d3749c0862c39f Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fl.fischer@fau.de>
Date: Mon, 2 Aug 2021 14:46:36 +0200
Subject: [PATCH] [eval.py] add ssh-port cli argument

This is needed since we use port 23 for ssh when our systems are in
evaluation mode
---
 eval.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/eval.py b/eval.py
index d760e77..4f94ec4 100755
--- a/eval.py
+++ b/eval.py
@@ -360,7 +360,7 @@ CLIENT_ERR = f'{ARG_PREFIX}.err'
 
 MEASURE_CMD = "/usr/bin/time -o {BENCHDIR}/server_stats.{RUN}.txt -v"
 MEASURE_IO_CMD = f"sar 1 1000 -o {ARG_PREFIX}.sar.data"
-REMOTE_CMD = "ssh -q {host}"
+REMOTE_CMD = "ssh -p {ssh_port} -q {host}"
 HOST = "faui49big02"
 
 STARTUP_TIME = 30
@@ -393,7 +393,7 @@ def write_desc(data_dir, verbose=False):
         print('uname_host: ', end='', file=desc_file)
 
     # collect the uname of the host
-    remote_cmd = REMOTE_CMD.format(host=HOST)
+    remote_cmd = REMOTE_CMD.format(host=HOST, ssh_port=SSH_PORT)
     uname_cmd = f'{remote_cmd} uname -a >> {desc_file_path}'
     cmd_run(uname_cmd, verbose=verbose)
 
@@ -564,7 +564,7 @@ def shutdown_server(server: subprocess.Popen, verbose=False):
     # kill the server using pkill(1) -9
     kill_cmd = ''
     if REMOTE_CMD:
-        kill_cmd += REMOTE_CMD.format(host=HOST) + ' '
+        kill_cmd += REMOTE_CMD.format(host=HOST, ssh_port=SSH_PORT) + ' '
 
     if isinstance(server.args, list):
         server_bin = server.args[0]
@@ -627,7 +627,7 @@ def bench(verbose=False) -> Dict[str, List[List[BenchResult]]]:
 
             cmd = ''
             if REMOTE_CMD:
-                remote_cmd = REMOTE_CMD.format(host=HOST)
+                remote_cmd = REMOTE_CMD.format(host=HOST, ssh_port=SSH_PORT)
                 # make sure the benchdir is available on the HOST
                 remote_prepare_cmd = f'{remote_cmd} mkdir -p {bench_dir}'
                 cmd_run(remote_prepare_cmd, verbose=verbose)
@@ -776,6 +776,10 @@ if __name__ == '__main__':
                         help='measure the IO done by all network interfaces',
                         default=False,
                         action='store_true')
+    parser.add_argument('--ssh-port',
+                        help='ssh port to use for the connection to the host',
+                        default=22,
+                        type=int)
     parser.add_argument(
         '--data-root',
         help='path where the experiment results should be saved',
@@ -860,6 +864,8 @@ if __name__ == '__main__':
             for i, c in SERVER_CMDS.items() if i in args.implementations
         }
 
+    SSH_PORT = args.ssh_port
+
     MEASURE_CMD = args.measure_cmd
 
     _cons = args.connections or CONS
-- 
GitLab