rename bw_mean to bw, other fixes
diff --git a/TODO b/TODO
index 8b13789..0feaffa 100644
--- a/TODO
+++ b/TODO
@@ -1 +1,4 @@
-
+Юнит-тесты
+Автоинтеграция с опенстек
+Отчеты
+Унифицировать имена параметров на входе и на выходе
diff --git a/fake_run_test.py b/fake_run_test.py
index 8dc772c..eeffde3 100644
--- a/fake_run_test.py
+++ b/fake_run_test.py
@@ -46,12 +46,12 @@
out = empty_fd
elif "iozone" == tool or "fio" == tool:
data = {'__meta__': {
- 'direct_io': 1,
+ 'direct': 1,
'action': 'r',
'concurence': 1,
'blocksize': 1,
'sync': 's'},
- 'bw_mean': 10}
+ 'bw': 10}
out = FakeFD(json.dumps(data))
else:
raise Exception("tool not found")
diff --git a/formatters.py b/formatters.py
index 967d8f3..185cae5 100644
--- a/formatters.py
+++ b/formatters.py
@@ -2,25 +2,14 @@
from utils import ssize_to_b
from statistic import med_dev
-
-
-def get_test_descr(data):
- rw = {"randread": "rr",
- "randwrite": "rw",
- "read": "sr",
- "write": "sw"}[data["action"]]
-
- return "{0}{1}{2}_th{3}".format(rw,
- data['sync_mode'],
- data['blocksize'],
- data['concurence'])
+from disk_perf_test_tool.tests.disk_test_agent import get_test_summary
def key_func(k_data):
_, data = k_data
bsz = ssize_to_b(data['blocksize'])
- tp = data['action']
+ tp = data['rw']
return tp, data['sync_mode'], bsz, data['concurence']
@@ -42,10 +31,10 @@
prev_k = curr_k
- descr = get_test_descr(data)
+ descr = get_test_summary(data)
iops, _ = med_dev(data['iops'])
- bw, bwdev = med_dev(data['bw_mean'])
+ bw, bwdev = med_dev(data['bw'])
# 3 * sigma
dev_perc = int((bwdev * 300) / bw)
diff --git a/io_results_loader.py b/io_results_loader.py
index bf8a585..6316a6d 100644
--- a/io_results_loader.py
+++ b/io_results_loader.py
@@ -44,7 +44,7 @@
val['blocksize_b'] = ssize_to_b(val['blocksize'])
val['iops_mediana'], val['iops_stddev'] = med_dev(val['iops'])
- val['bw_mediana'], val['bw_stddev'] = med_dev(val['bw_mean'])
+ val['bw_mediana'], val['bw_stddev'] = med_dev(val['bw'])
val['lat_mediana'], val['lat_stddev'] = med_dev(val['lat'])
yield val
diff --git a/report.py b/report.py
index bce6690..62489f1 100644
--- a/report.py
+++ b/report.py
@@ -176,7 +176,7 @@
#('hdd_test_rws4k', ('concurence', 'lat', 'iops')),
#('hdd_test_rrs4k', ('concurence', 'lat', 'iops')),
('hdd_test_rrd4k', ('concurence', 'lat', 'iops')),
- ('hdd_test_swd1m', ('concurence', 'lat', 'bw_mean')),
+ ('hdd_test_swd1m', ('concurence', 'lat', 'bw')),
]
for name_filter, fields in name_filters:
diff --git a/run_test.py b/run_test.py
index 60ffbbc..6bfad3f 100755
--- a/run_test.py
+++ b/run_test.py
@@ -308,6 +308,9 @@
start_vms.nova_connect(user, passwd, tenant, auth_url)
+ logger.info("Preparing openstack")
+ start_vms.prepare_os(user, passwd, tenant, auth_url)
+
new_nodes = []
for new_node, node_id in start_vms.launch_vms(params):
new_node.roles.append('testnode')
@@ -430,10 +433,11 @@
def load_data_from(var_dir):
- def closure(cfg, ctx):
+ def load_data_from_file(cfg, ctx):
raw_results = os.path.join(var_dir, 'raw_results.yaml')
+ print "load data from", raw_results
ctx.results = yaml.load(open(raw_results).read())
- return closure
+ return load_data_from_file
def main(argv):
diff --git a/scripts/data.py b/scripts/data.py
index 2725a26..c666250 100644
--- a/scripts/data.py
+++ b/scripts/data.py
@@ -70,7 +70,7 @@
if meta['sync']:
meta['sync'] = 's'
- elif meta['direct_io']:
+ elif meta['direct']:
meta['sync'] = 'd'
else:
meta['sync'] = 'a'
@@ -78,7 +78,7 @@
meta['fsize'] = kb_to_ssize(meta['size'] * meta['concurence'])
key = ("{action} {sync} {blocksize}k " +
"{concurence} {fsize}").format(**meta)
- results.setdefault(key, []).append(val['bw_mean'])
+ results.setdefault(key, []).append(val['bw'])
cmeta = results_meta.setdefault(key, {})
cmeta.setdefault('times', []).append(get_test_time(prev_block))
diff --git a/scripts/data2.py b/scripts/data2.py
index 4a8dad9..1ba3b58 100644
--- a/scripts/data2.py
+++ b/scripts/data2.py
@@ -31,11 +31,11 @@
for (bs, cache_tp, act, conc), curr_data in sorted(grouped.items()):
iops = med_dev([i['iops'] * int(conc) for i in curr_data])
- bw_mean = med_dev([i['bw_mean'] * int(conc) for i in curr_data])
+ bw = med_dev([i['bw'] * int(conc) for i in curr_data])
lat = med_dev([i['lat'] / 1000 for i in curr_data])
iops = round_deviation(iops)
- bw_mean = round_deviation(bw_mean)
+ bw = round_deviation(bw)
lat = round_deviation(lat)
params = dict(
@@ -43,7 +43,7 @@
action=act,
cache_tp=cache_tp,
iops=iops,
- bw=bw_mean,
+ bw=bw,
lat=lat,
conc=conc
)
diff --git a/scripts/fio_tests_configs/io_task.cfg b/scripts/fio_tests_configs/io_task.cfg
index cc3d07d..b2f73c8 100644
--- a/scripts/fio_tests_configs/io_task.cfg
+++ b/scripts/fio_tests_configs/io_task.cfg
@@ -1,10 +1,24 @@
-[writetest]
-blocksize=4k
-filename=/tmp/xxx.bin
-rw=randwrite
-direct=1
+[defaults]
+wait_for_previous
+group_reporting
+time_based
buffered=0
-ioengine=libaio
iodepth=1
-size=1Gb
-runtime=5
+
+filename={FILENAME}
+NUM_ROUNDS=1
+
+ramp_time=5
+size=10Gb
+runtime=30
+
+# ---------------------------------------------------------------------
+# check different thread count, direct read mode. (latency, iops) = func(th_count)
+# also check iops for randread
+# ---------------------------------------------------------------------
+[hdd_test_{TEST_SUMM} * {NUM_ROUNDS}]
+blocksize=4k
+rw=randwrite
+sync=1
+numjobs=80
+
diff --git a/scripts/fio_tests_configs/io_task_test.cfg b/scripts/fio_tests_configs/io_task_test.cfg
index 682fbd1..4d68493 100644
--- a/scripts/fio_tests_configs/io_task_test.cfg
+++ b/scripts/fio_tests_configs/io_task_test.cfg
@@ -1,23 +1,24 @@
[defaults]
group_reporting
wait_for_previous
-ramp_time=15
+ramp_time=0
filename={FILENAME}
buffered=0
iodepth=1
size=1000Mb
time_based
+RUNTIME=10
-[writetest * {ROUNDS}]
+[writetest * {NUM_ROUNDS}]
blocksize=4k
rw=randwrite
direct=1
-runtime=30
+runtime={RUNTIME}
numjobs=1
-[readtest * {ROUNDS}]
+[readtest * {NUM_ROUNDS}]
numjobs=4
blocksize=4k
rw=randread
direct=1
-runtime=30
+runtime={RUNTIME}
diff --git a/scripts/postprocessing/io_py_result_processor.py b/scripts/postprocessing/io_py_result_processor.py
index befe4eb..0b7bf1c 100644
--- a/scripts/postprocessing/io_py_result_processor.py
+++ b/scripts/postprocessing/io_py_result_processor.py
@@ -177,11 +177,11 @@
# for (bs, cache_tp, act, conc), curr_data in sorted(grouped.items()):
# iops = med_dev([i['iops'] * int(conc) for i in curr_data])
- # bw_mean = med_dev([i['bw_mean'] * int(conc) for i in curr_data])
+ # bw = med_dev([i['bw'] * int(conc) for i in curr_data])
# lat = med_dev([i['lat'] / 1000 for i in curr_data])
# iops = round_deviation(iops)
- # bw_mean = round_deviation(bw_mean)
+ # bw = round_deviation(bw)
# lat = round_deviation(lat)
# params = dict(
@@ -189,7 +189,7 @@
# action=act,
# cache_tp=cache_tp,
# iops=iops,
- # bw=bw_mean,
+ # bw=bw,
# lat=lat,
# conc=conc
# )
diff --git a/scripts/postprocessing/stat.py b/scripts/postprocessing/stat.py
index c1368e8..39b9d99 100644
--- a/scripts/postprocessing/stat.py
+++ b/scripts/postprocessing/stat.py
@@ -9,7 +9,7 @@
import io_py_result_processor as io_test
-key_pos = {'blocksize': 0, 'direct_io': 1, 'name': 2}
+key_pos = {'blocksize': 0, 'direct': 1, 'name': 2}
actions = ['randwrite', 'randread', 'read', 'write']
types = ['s', 'd']
colors = ['red', 'green', 'blue', 'cyan',
diff --git a/start_vms.py b/start_vms.py
index b872d32..f7d097c 100644
--- a/start_vms.py
+++ b/start_vms.py
@@ -2,6 +2,7 @@
import os
import time
import logging
+import subprocess
from concurrent.futures import ThreadPoolExecutor
@@ -44,6 +45,25 @@
NOVA_CONNECTION = None
+def prepare_os(name=None, passwd=None, tenant=None, auth_url=None):
+ if name is None:
+ name, passwd, tenant, auth_url = ostack_get_creds()
+
+ params = {
+ 'OS_USERNAME': name,
+ 'OS_PASSWORD': passwd,
+ 'OS_TENANT_NAME': tenant,
+ 'OS_AUTH_URL': auth_url
+ }
+
+ params_s = " ".join("{}={}".format(k, v) for k, v in params.items())
+
+ cmd = "env {params} bash scripts/prepare.sh".format(params_s)
+ subprocess.call(cmd, shell=True)
+
+ return NOVA_CONNECTION
+
+
# def get_or_create_aa_group(nova, name):
# try:
# group = conn.server_groups.find(name=name)
diff --git a/tests/disk_test_agent.py b/tests/disk_test_agent.py
index b129175..e0af6e7 100644
--- a/tests/disk_test_agent.py
+++ b/tests/disk_test_agent.py
@@ -16,23 +16,41 @@
SETTING = 1
+def get_test_sync_mode(jconfig):
+ try:
+ return jconfig['sync_mode']
+ except KeyError:
+ pass
+
+ is_sync = jconfig.get("sync", "0") == "1"
+ is_direct = jconfig.get("direct", "0") == "1"
+
+ if is_sync and is_direct:
+ return 'x'
+ elif is_sync:
+ return 's'
+ elif is_direct:
+ return 'd'
+ else:
+ return 'a'
+
+
def get_test_summary(params):
rw = {"randread": "rr",
"randwrite": "rw",
"read": "sr",
"write": "sw"}[params["rw"]]
- if params.get("direct") == '1':
- sync_mode = 'd'
- elif params.get("sync") == '1':
- sync_mode = 's'
- else:
- sync_mode = 'a'
+ sync_mode = get_test_sync_mode(params)
+ th_count = params.get('numjobs')
+ if th_count is None:
+ th_count = params.get('concurence', '1')
+ th_count = int(th_count)
- th_count = int(params.get('numjobs', '1'))
-
- return "{0}{1}{2}th{3}".format(rw, sync_mode,
- params['blocksize'], th_count)
+ return "{0}{1}{2}th{3}".format(rw,
+ sync_mode,
+ params['blocksize'],
+ th_count)
counter = [0]
@@ -384,20 +402,6 @@
yield bconf
-def get_test_sync_mode(jconfig):
- is_sync = jconfig.get("sync", "0") == "1"
- is_direct = jconfig.get("direct_io", "0") == "1"
-
- if is_sync and is_direct:
- return 'sd'
- elif is_sync:
- return 's'
- elif is_direct:
- return 'd'
- else:
- return 'a'
-
-
def add_job_results(jname, job_output, jconfig, res):
if job_output['write']['iops'] != 0:
raw_result = job_output['write']
@@ -406,7 +410,7 @@
if jname not in res:
j_res = {}
- j_res["action"] = jconfig["rw"]
+ j_res["rw"] = jconfig["rw"]
j_res["sync_mode"] = get_test_sync_mode(jconfig)
j_res["concurence"] = int(jconfig.get("numjobs", 1))
j_res["blocksize"] = jconfig["blocksize"]
@@ -415,7 +419,8 @@
int(jconfig.get("ramp_time", 0))]
else:
j_res = res[jname]
- assert j_res["action"] == jconfig["rw"]
+ assert j_res["rw"] == jconfig["rw"]
+ assert j_res["rw"] == jconfig["rw"]
assert j_res["sync_mode"] == get_test_sync_mode(jconfig)
assert j_res["concurence"] == int(jconfig.get("numjobs", 1))
assert j_res["blocksize"] == jconfig["blocksize"]
@@ -428,9 +433,7 @@
def j_app(name, x):
j_res.setdefault(name, []).append(x)
- # 'bw_dev bw_mean bw_max bw_min'.split()
- # probably fix fio bug - iops is scaled to joncount, but bw - isn't
- j_app("bw_mean", raw_result["bw_mean"] * j_res["concurence"])
+ j_app("bw", raw_result["bw"])
j_app("iops", raw_result["iops"])
j_app("lat", raw_result["lat"]["mean"])
j_app("clat", raw_result["clat"]["mean"])
diff --git a/tests/io_scenario_hdd.cfg b/tests/io_scenario_hdd.cfg
index 0c36324..46210b7 100644
--- a/tests/io_scenario_hdd.cfg
+++ b/tests/io_scenario_hdd.cfg
@@ -16,7 +16,7 @@
# check different thread count, sync mode. (latency, iops) = func(th_count)
# ---------------------------------------------------------------------
[hdd_test_{TEST_SUMM} * {NUM_ROUNDS}]
-blocksize={% 4k %}
+blocksize=4k
rw=randwrite
sync=1
numjobs={% 1, 5, 10, 15, 20, 30, 40, 80, 120 %}
@@ -26,7 +26,7 @@
# also check iops for randread
# ---------------------------------------------------------------------
[hdd_test_{TEST_SUMM} * {NUM_ROUNDS}]
-blocksize={% 4k %}
+blocksize=4k
rw=randread
direct=1
numjobs={% 1, 5, 10, 15, 20, 30, 40, 80, 120 %}
@@ -36,7 +36,7 @@
# also check BW for seq read/write.
# ---------------------------------------------------------------------
[hdd_test_{TEST_SUMM} * {NUM_ROUNDS}]
-blocksize={% 1m %}
+blocksize=1m
rw={% read, write %}
direct=1
numjobs={% 1, 5, 10, 15, 20, 30, 40, 80, 120 %}
@@ -48,4 +48,3 @@
blocksize=4k
rw=randwrite
direct=1
-
diff --git a/tests/io_scenario_long_test.cfg b/tests/io_scenario_long_test.cfg
index b1a40d9..4b0a79d 100644
--- a/tests/io_scenario_long_test.cfg
+++ b/tests/io_scenario_long_test.cfg
@@ -1,6 +1,8 @@
[defaults]
+
# 24h test
-NUM_ROUNDS=288
+NUM_ROUNDS1=270
+NUM_ROUNDS2=261
buffered=0
wait_for_previous
@@ -13,7 +15,13 @@
# ---------------------------------------------------------------------
# check read and write linearity. oper_time = func(size)
# ---------------------------------------------------------------------
-[24h_test * {NUM_ROUNDS}]
+[24h_test * {NUM_ROUNDS1}]
+blocksize=128k
+rw=randwrite
+direct=1
+runtime=30
+
+[24h_test * {NUM_ROUNDS2}]
blocksize=128k
rw=randwrite
direct=1
diff --git a/tests/itest.py b/tests/itest.py
index 3b71d3f..1dbbe13 100644
--- a/tests/itest.py
+++ b/tests/itest.py
@@ -177,7 +177,7 @@
merged_result = results[0]
merged_data = merged_result['res']
expected_keys = set(merged_data.keys())
- mergable_fields = ['bw_mean', 'clat', 'iops', 'lat', 'slat']
+ mergable_fields = ['bw', 'clat', 'iops', 'lat', 'slat']
for res in results[1:]:
assert res['__meta__'] == merged_result['__meta__']