diff options
author | Mark Beierl <mark.beierl@dell.com> | 2016-11-22 10:26:06 -0500 |
---|---|---|
committer | Mark Beierl <mark.beierl@dell.com> | 2016-11-22 10:26:06 -0500 |
commit | 677d8f93db164ac7fb15811d5ce1e1a0eee30160 (patch) | |
tree | 276a7dff89655a4a63b919be931fcc8e4cc76fa8 | |
parent | f09c2268771efba4d067e605905e6f7268bcb56f (diff) |
Wait for agent status
Test the agent's ssh port prior to proceeding with test
Change-Id: Iff65f2c12a50063aa9f2ee4b75638ec0666ded1b
JIRA: STORPERF-34
Signed-off-by: Mark Beierl <mark.beierl@dell.com>
-rw-r--r-- | storperf/storperf_master.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/storperf/storperf_master.py b/storperf/storperf_master.py index aa1b9b6..91b1bd1 100644 --- a/storperf/storperf_master.py +++ b/storperf/storperf_master.py @@ -10,6 +10,7 @@ from datetime import datetime import logging import os +import socket import subprocess from threading import Thread from time import sleep @@ -335,6 +336,26 @@ class StorPerfMaster(object): logger.info("Initializing slave at " + slave) + logger.debug("Checking if slave " + slave + " is alive") + + alive = False + timer = 10 + while not alive: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + result = s.connect_ex((slave, 22)) + s.close() + + if result: + alive = False + sleep(1) + timer -= 1 + if timer == 0: + logger.debug("Still waiting for slave " + slave) + timer = 10 + else: + alive = True + logger.debug("Slave " + slave + " is alive and ready") + args = ['scp', '-o', 'StrictHostKeyChecking=no', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'LogLevel=error', |