diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2021-02-19 18:19:00 +0300 |
---|---|---|
committer | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2021-05-04 11:37:26 +0300 |
commit | 0dc9f816d4d92d287c32e609939b68a8237c368b (patch) | |
tree | b525c77b611f0253e43ca2ce1146fa6ab3e72c89 /scripts/simplebench/bench_block_job.py | |
parent | 4ad7a5c06535d36d955928cac0352be13cf6f712 (diff) |
simplebench/bench-backup: support qcow2 source files
Add support for qcow2 source. New option says to use test-source.qcow2
instead of test-source. Of course, test-source.qcow2 should be
precreated.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'scripts/simplebench/bench_block_job.py')
-rwxr-xr-x | scripts/simplebench/bench_block_job.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/simplebench/bench_block_job.py b/scripts/simplebench/bench_block_job.py index 71d2e489c8..4f03c12169 100755 --- a/scripts/simplebench/bench_block_job.py +++ b/scripts/simplebench/bench_block_job.py @@ -88,6 +88,11 @@ def get_image_size(path): return json.loads(out)['virtual-size'] +def get_blockdev_size(obj): + img = obj['filename'] if 'filename' in obj else obj['file']['filename'] + return get_image_size(img) + + # Bench backup or mirror def bench_block_copy(qemu_binary, cmd, cmd_options, source, target): """Helper to run bench_block_job() for mirror or backup""" @@ -101,7 +106,7 @@ def bench_block_copy(qemu_binary, cmd, cmd_options, source, target): subprocess.run(['qemu-img', 'create', '-f', 'qcow2', target['file']['filename'], - str(get_image_size(source['filename']))], + str(get_blockdev_size(source))], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True) |