fix python 2.6 compatibility
diff --git a/wally/config.py b/wally/config.py
index 9626332..d8b7085 100644
--- a/wally/config.py
+++ b/wally/config.py
@@ -95,7 +95,10 @@
else:
record.levelname = prn_name
- res = super(ColoredFormatter, self).format(record)
+ # super doesn't work here in 2.6 O_o
+ res = logging.Formatter.format(self, record)
+
+ # res = super(ColoredFormatter, self).format(record)
# restore record, as it will be used by other formatters
record.__dict__ = orig
diff --git a/wally/discover/node.py b/wally/discover/node.py
index 8659fe6..c2ae5aa 100644
--- a/wally/discover/node.py
+++ b/wally/discover/node.py
@@ -1,4 +1,4 @@
-import urlparse
+from wally.ssh_utils import parse_ssh_uri
class Node(object):
@@ -12,19 +12,17 @@
def get_ip(self):
if self.conn_url == 'local':
return '127.0.0.1'
- return urlparse.urlparse(self.conn_url).hostname
+
+ assert self.conn_url.startswith("ssh://")
+ return parse_ssh_uri(self.conn_url[6:]).host
def get_conn_id(self):
if self.conn_url == 'local':
return '127.0.0.1'
- host = urlparse.urlparse(self.conn_url).hostname
- port = urlparse.urlparse(self.conn_url).port
-
- if port is None:
- port = 22
-
- return host + ":" + str(port)
+ assert self.conn_url.startswith("ssh://")
+ creds = parse_ssh_uri(self.conn_url[6:])
+ return "{0.host}:{0.port}".format(creds)
def __str__(self):
templ = "<Node: url={conn_url!r} roles={roles}" + \
diff --git a/wally/fuel_rest_api.py b/wally/fuel_rest_api.py
index 499510d..737bf2e 100644
--- a/wally/fuel_rest_api.py
+++ b/wally/fuel_rest_api.py
@@ -47,7 +47,7 @@
else:
data_json = json.dumps(params)
- logger.debug("HTTP: {} {}".format(method.upper(), url))
+ logger.debug("HTTP: {0} {1}".format(method.upper(), url))
request = urllib2.Request(url,
data=data_json,
@@ -58,7 +58,7 @@
request.get_method = lambda: method.upper()
response = urllib2.urlopen(request)
- logger.debug("HTTP Responce: {}".format(response.code))
+ logger.debug("HTTP Responce: {0}".format(response.code))
if response.code < 200 or response.code > 209:
raise IndexError(url)
@@ -124,12 +124,12 @@
self.__connection__ = conn
def __str__(self):
- res = ["{}({}):".format(self.__class__.__name__, self.name)]
+ res = ["{0}({1}):".format(self.__class__.__name__, self.name)]
for k, v in sorted(self.__dict__.items()):
if k.startswith('__') or k.endswith('__'):
continue
if k != 'name':
- res.append(" {}={!r}".format(k, v))
+ res.append(" {0}={1!r}".format(k, v))
return "\n".join(res)
def __getitem__(self, item):
diff --git a/wally/run_test.py b/wally/run_test.py
index 44b65c0..96b8af2 100755
--- a/wally/run_test.py
+++ b/wally/run_test.py
@@ -54,15 +54,12 @@
url = node.conn_url[len(ssh_pref):]
if vm:
- ret_count = 24
- log_warns = False
+ conn_timeout = 240
else:
- ret_count = 3
- log_warns = True
+ conn_timeout = 30
node.connection = ssh_utils.connect(url,
- retry_count=ret_count,
- log_warns=log_warns)
+ conn_timeout=conn_timeout)
else:
raise ValueError("Unknown url type {0}".format(node.conn_url))
except Exception as exc:
diff --git a/wally/sensors/protocol.py b/wally/sensors/protocol.py
index 7688f31..a67ddde 100644
--- a/wally/sensors/protocol.py
+++ b/wally/sensors/protocol.py
@@ -104,8 +104,8 @@
vals = [data[header].value - self.prev.get(header, 0)
for header in self.headers]
- self.prev.update({header: data[header].value
- for header in self.headers})
+ self.prev.update(dict((header, data[header].value)
+ for header in self.headers))
else:
vals = [data[header].value for header in self.headers]
diff --git a/wally/ssh_utils.py b/wally/ssh_utils.py
index d928a82..f4de3b6 100644
--- a/wally/ssh_utils.py
+++ b/wally/ssh_utils.py
@@ -51,16 +51,19 @@
return open(*args, **kwarhgs)
-def ssh_connect(creds, retry_count=6, timeout=10, log_warns=True):
+def ssh_connect(creds, conn_timeout=60):
if creds == 'local':
return Local
+ tcp_timeout = 30
ssh = paramiko.SSHClient()
ssh.load_host_keys('/dev/null')
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.known_hosts = None
- for i in range(retry_count):
+ etime = time.time() + conn_timeout
+
+ while True:
try:
if creds.user is None:
user = getpass.getuser()
@@ -69,7 +72,7 @@
if creds.passwd is not None:
ssh.connect(creds.host,
- timeout=timeout, # tcp connect timeout
+ timeout=tcp_timeout,
username=user,
password=creds.passwd,
port=creds.port,
@@ -80,7 +83,7 @@
if creds.key_file is not None:
ssh.connect(creds.host,
username=user,
- timeout=timeout, # tcp connect timeout
+ timeout=tcp_timeout,
key_filename=creds.key_file,
look_for_keys=False,
port=creds.port)
@@ -89,28 +92,16 @@
key_file = os.path.expanduser('~/.ssh/id_rsa')
ssh.connect(creds.host,
username=user,
- timeout=timeout, # tcp connect timeout
+ timeout=tcp_timeout,
key_filename=key_file,
look_for_keys=False,
port=creds.port)
return ssh
- # raise ValueError("Wrong credentials {0}".format(creds.__dict__))
except paramiko.PasswordRequiredException:
raise
except socket.error:
- retry_left = retry_count - i - 1
-
- if retry_left > 0:
- if log_warns:
- msg = "Node {0.host}:{0.port} connection timeout."
-
- if 0 != retry_left:
- msg += " {0} retry left.".format(retry_left)
-
- logger.warning(msg.format(creds))
- else:
+ if time.time() > etime:
raise
-
time.sleep(1)
diff --git a/wally/start_vms.py b/wally/start_vms.py
index de1f312..e3b9245 100644
--- a/wally/start_vms.py
+++ b/wally/start_vms.py
@@ -80,7 +80,7 @@
'OS_AUTH_URL': auth_url
}
- params_s = " ".join("{}={}".format(k, v) for k, v in params.items())
+ params_s = " ".join("{0}={1}".format(k, v) for k, v in params.items())
spath = os.path.dirname(wally.__file__)
spath = os.path.dirname(spath)
@@ -389,9 +389,9 @@
# wait till vm actually deleted
- logger.warning("Volume deletion commented out")
- # for vol in volumes_to_delete:
- # logger.debug("Deleting volume " + vol.display_name)
- # cinder.volumes.delete(vol)
+ # logger.warning("Volume deletion commented out")
+ for vol in volumes_to_delete:
+ logger.debug("Deleting volume " + vol.display_name)
+ cinder.volumes.delete(vol)
logger.debug("Clearing done (yet some volumes may still deleting)")
diff --git a/wally/suits/io/agent.py b/wally/suits/io/agent.py
index c012950..b11f20e 100644
--- a/wally/suits/io/agent.py
+++ b/wally/suits/io/agent.py
@@ -361,6 +361,9 @@
# set timeout
raw_out, raw_err = p.communicate(benchmark_config)
+ # HACK
+ raw_out = "{" + raw_out.split('{', 1)[1]
+
if 0 != p.returncode:
msg = "Fio failed with code: {0}\nOutput={1}"
raise OSError(msg.format(p.returncode, raw_err))
diff --git a/wally/suits/io/io_scenario_ceph.cfg b/wally/suits/io/ceph.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_ceph.cfg
rename to wally/suits/io/ceph.cfg
diff --git a/wally/suits/io/io_scenario_check_distribution.cfg b/wally/suits/io/check_distribution.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_check_distribution.cfg
rename to wally/suits/io/check_distribution.cfg
diff --git a/wally/suits/io/io_scenario_check_linearity.cfg b/wally/suits/io/check_linearity.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_check_linearity.cfg
rename to wally/suits/io/check_linearity.cfg
diff --git a/wally/suits/io/io_scenario_check_th_count.cfg b/wally/suits/io/check_th_count.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_check_th_count.cfg
rename to wally/suits/io/check_th_count.cfg
diff --git a/wally/suits/io/io_scenario_check_warmup.cfg b/wally/suits/io/check_warmup.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_check_warmup.cfg
rename to wally/suits/io/check_warmup.cfg
diff --git a/wally/suits/io/io_scenario_hdd.cfg b/wally/suits/io/hdd.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_hdd.cfg
rename to wally/suits/io/hdd.cfg
diff --git a/wally/suits/io/io_scenario_long_test.cfg b/wally/suits/io/long_test.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_long_test.cfg
rename to wally/suits/io/long_test.cfg
diff --git a/wally/suits/io/io_scenario_check_vm_count_ec2.cfg b/wally/suits/io/vm_count_ec2.cfg
similarity index 100%
rename from wally/suits/io/io_scenario_check_vm_count_ec2.cfg
rename to wally/suits/io/vm_count_ec2.cfg
diff --git a/wally/suits/itest.py b/wally/suits/itest.py
index 0b8a131..0f8afd4 100644
--- a/wally/suits/itest.py
+++ b/wally/suits/itest.py
@@ -156,9 +156,9 @@
files[fname] = max(files.get(fname, 0), msz)
# logger.warning("dd run DISABLED")
- cmd_templ = "dd if=/dev/zero of={0} bs={1} count={2}"
+ # cmd_templ = "dd if=/dev/zero of={0} bs={1} count={2}"
- # cmd_templ = "sudo dd if=/dev/zero of={0} bs={1} count={2}"
+ cmd_templ = "sudo dd if=/dev/zero of={0} bs={1} count={2}"
ssize = 0
stime = time.time()
@@ -176,10 +176,8 @@
logger.warning("Test files prefill disabled")
def run(self, conn, barrier):
- # logger.warning("No tests runned")
- # return
- # cmd_templ = "sudo env python2 {0} --type {1} {2} --json -"
- cmd_templ = "env python2 {0} --type {1} {2} --json -"
+ cmd_templ = "sudo env python2 {0} --type {1} {2} --json -"
+ # cmd_templ = "env python2 {0} --type {1} {2} --json -"
params = " ".join("{0}={1}".format(k, v)
for k, v in self.config_params.items())