diff --git a/MAINTAINERS b/MAINTAINERS index 75e0f2d750..a77f246569 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2525,6 +2525,7 @@ Benchmark util M: Vladimir Sementsov-Ogievskiy S: Maintained F: scripts/simplebench/ +T: git https://src.openvz.org/scm/~vsementsov/qemu.git simplebench Transactions helper M: Vladimir Sementsov-Ogievskiy diff --git a/scripts/simplebench/bench-backup.py b/scripts/simplebench/bench-backup.py index 33a1ecfefa..5a0675c593 100755 --- a/scripts/simplebench/bench-backup.py +++ b/scripts/simplebench/bench-backup.py @@ -23,7 +23,7 @@ import json import simplebench from results_to_text import results_to_text -from bench_block_job import bench_block_copy, drv_file, drv_nbd +from bench_block_job import bench_block_copy, drv_file, drv_nbd, drv_qcow2 def bench_func(env, case): @@ -37,29 +37,56 @@ def bench_func(env, case): def bench(args): test_cases = [] - sources = {} - targets = {} - for d in args.dir: - label, path = d.split(':') # paths with colon not supported - sources[label] = drv_file(path + '/test-source') - targets[label] = drv_file(path + '/test-target') + # paths with colon not supported, so we just split by ':' + dirs = dict(d.split(':') for d in args.dir) + nbd_drv = None if args.nbd: nbd = args.nbd.split(':') host = nbd[0] port = '10809' if len(nbd) == 1 else nbd[1] - drv = drv_nbd(host, port) - sources['nbd'] = drv - targets['nbd'] = drv + nbd_drv = drv_nbd(host, port) for t in args.test: src, dst = t.split(':') - test_cases.append({ - 'id': t, - 'source': sources[src], - 'target': targets[dst] - }) + if src == 'nbd' and dst == 'nbd': + raise ValueError("Can't use 'nbd' label for both src and dst") + + if (src == 'nbd' or dst == 'nbd') and not nbd_drv: + raise ValueError("'nbd' label used but --nbd is not given") + + if src == 'nbd': + source = nbd_drv + elif args.qcow2_sources: + source = drv_qcow2(drv_file(dirs[src] + '/test-source.qcow2')) + else: + source = drv_file(dirs[src] + '/test-source') + + if dst == 'nbd': + test_cases.append({'id': t, 'source': source, 'target': nbd_drv}) + continue + + if args.target_cache == 'both': + target_caches = ['direct', 'cached'] + else: + target_caches = [args.target_cache] + + for c in target_caches: + o_direct = c == 'direct' + fname = dirs[dst] + '/test-target' + if args.compressed: + fname += '.qcow2' + target = drv_file(fname, o_direct=o_direct) + if args.compressed: + target = drv_qcow2(target) + + test_id = t + if args.target_cache == 'both': + test_id += f'({c})' + + test_cases.append({'id': test_id, 'source': source, + 'target': target}) binaries = [] # list of (