diff options
-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', |