From e02cda008591317b1625707ff8e115a4841aa889 Mon Sep 17 00:00:00 2001 From: Timos Ampelikiotis Date: Tue, 10 Oct 2023 11:40:56 +0000 Subject: Introduce Virtio-loopback epsilon release: Epsilon release introduces a new compatibility layer which make virtio-loopback design to work with QEMU and rust-vmm vhost-user backend without require any changes. Signed-off-by: Timos Ampelikiotis Change-Id: I52e57563e08a7d0bdc002f8e928ee61ba0c53dd9 --- scripts/simplebench/bench-backup.py | 228 +++++++++++++++++++++++++++++ scripts/simplebench/bench-example.py | 81 ++++++++++ scripts/simplebench/bench_block_job.py | 159 ++++++++++++++++++++ scripts/simplebench/bench_prealloc.py | 132 +++++++++++++++++ scripts/simplebench/bench_write_req.py | 171 ++++++++++++++++++++++ scripts/simplebench/img_bench_templater.py | 95 ++++++++++++ scripts/simplebench/results_to_text.py | 126 ++++++++++++++++ scripts/simplebench/simplebench.py | 140 ++++++++++++++++++ scripts/simplebench/table_templater.py | 62 ++++++++ 9 files changed, 1194 insertions(+) create mode 100755 scripts/simplebench/bench-backup.py create mode 100644 scripts/simplebench/bench-example.py create mode 100755 scripts/simplebench/bench_block_job.py create mode 100755 scripts/simplebench/bench_prealloc.py create mode 100755 scripts/simplebench/bench_write_req.py create mode 100755 scripts/simplebench/img_bench_templater.py create mode 100755 scripts/simplebench/results_to_text.py create mode 100644 scripts/simplebench/simplebench.py create mode 100644 scripts/simplebench/table_templater.py (limited to 'scripts/simplebench') diff --git a/scripts/simplebench/bench-backup.py b/scripts/simplebench/bench-backup.py new file mode 100755 index 000000000..5a0675c59 --- /dev/null +++ b/scripts/simplebench/bench-backup.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +# +# Bench backup block-job +# +# Copyright (c) 2020 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import argparse +import json + +import simplebench +from results_to_text import results_to_text +from bench_block_job import bench_block_copy, drv_file, drv_nbd, drv_qcow2 + + +def bench_func(env, case): + """ Handle one "cell" of benchmarking table. """ + cmd_options = env['cmd-options'] if 'cmd-options' in env else {} + return bench_block_copy(env['qemu-binary'], env['cmd'], + cmd_options, + case['source'], case['target']) + + +def bench(args): + test_cases = [] + + # 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] + nbd_drv = drv_nbd(host, port) + + for t in args.test: + src, dst = t.split(':') + + 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 (