>From 807eefab80e06244c973098a9a012fe3871d19b8 Mon Sep 17 00:00:00 2001 From: Claudio Fontana Date: Tue, 21 Jul 2020 10:06:37 +0200 Subject: [PATCH 1/2] iotests/300: new test for catching backing file migration issue this test has been split off from 267, checking only the backing file, and not "requiring" any components, as to make it easier to debug and run under valgrind. Signed-off-by: Claudio Fontana --- tests/qemu-iotests/300 | 100 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/300.out | 17 ++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 118 insertions(+) create mode 100755 tests/qemu-iotests/300 create mode 100644 tests/qemu-iotests/300.out diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 new file mode 100755 index 0000000000..aec01c6691 --- /dev/null +++ b/tests/qemu-iotests/300 @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# +# Test which nodes are involved in internal snapshots +# +# Copyright (C) 2019 Red Hat, Inc. +# +# 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 . +# + +# creator +owner=kwolf@redhat.com + +# adapted by Claudio Fontana +# +# this is a standalone extract from 267 focused on the first backing file +# testcase, which failed consistently on s390 and less consistently +# on X86 under particular conditions, depending on the number of fields +# in the migration stream. +# +# Also, in contrast to 267, we do not "require" anything, +# which fixes running under valgrind, which otherwise breaks. +# + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +# Internal snapshots are (currently) impossible with refcount_bits=1, +# and generally impossible with external data files +_unsupported_imgopts 'refcount_bits=1[^0-9]' data_file + +do_run_qemu() +{ + echo Testing: "$@" + ( + if ! test -t 0; then + while read cmd; do + echo $cmd + done + fi + echo quit + ) | $QEMU -nographic -monitor stdio -nodefaults "$@" + echo +} + +run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp | + _filter_generated_node_ids | _filter_imgfmt | _filter_vmstate_size +} + +size=128M + +run_test() +{ + _make_test_img -b "$BACKING_FILE" -F $IMGFMT $size + printf "savevm snap0\ninfo snapshots\nloadvm snap0\n" | run_qemu "$@" | _filter_date +} + +echo +echo "=== -blockdev with a backing file ===" +echo + +TEST_IMG="$TEST_IMG.base" _make_test_img $size + +BACKING_FILE="$TEST_IMG.base" \ +run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ + -blockdev driver=file,filename="$TEST_IMG",node-name=file \ + -blockdev driver=$IMGFMT,file=file,backing=backing-file,node-name=fmt + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/300.out b/tests/qemu-iotests/300.out new file mode 100644 index 0000000000..9904043638 --- /dev/null +++ b/tests/qemu-iotests/300.out @@ -0,0 +1,17 @@ +QA output created by 300 + +=== -blockdev with a backing file === + +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT +Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT.base,node-name=backing-file -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=file -blockdev driver=IMGFMT,file=file,backing=backing-file,node-name=fmt +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) savevm snap0 +(qemu) info snapshots +List of snapshots present on all disks: +ID TAG VM SIZE DATE VM CLOCK +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000 +(qemu) loadvm snap0 +(qemu) quit + +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 1d0252e1f0..cb66b5a58c 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -307,4 +307,5 @@ 296 rw 297 meta 299 auto quick +300 rw auto quick snapshot backing 301 backing quick -- 2.16.4