qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qemu-iotests: Fix 232 for non-qcow2

232 is marked as generic, but commit 12efe428c9e added code that assumes
qcow2. What the new test really needs is backing files and support for
updating the backing file link (.bdrv_change_backing_file).

Split the non-generic code into a new test case 247 and make it work
with qed, too.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>

+102 -50
-30
tests/qemu-iotests/232
··· 144 144 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0,auto-read-only=on 145 145 run_qemu_info_block -blockdev driver=file,filename="$TEST_IMG",node-name=node0 146 146 147 - echo 148 - echo "=== Try commit to backing file with auto-read-only ===" 149 - echo 150 - 151 - TEST_IMG="$TEST_IMG.0" _make_test_img $size 152 - TEST_IMG="$TEST_IMG.1" _make_test_img $size 153 - TEST_IMG="$TEST_IMG.2" _make_test_img $size 154 - TEST_IMG="$TEST_IMG.3" _make_test_img $size 155 - TEST_IMG="$TEST_IMG.4" _make_test_img $size 156 - 157 - (cat <<EOF 158 - {"execute":"qmp_capabilities"} 159 - {"execute":"block-commit", 160 - "arguments":{"device":"format-4", "top-node": "format-2", "base-node":"format-0", "job-id":"job0"}} 161 - EOF 162 - sleep 1 163 - echo '{"execute":"quit"}' 164 - ) | $QEMU -qmp stdio -nographic -nodefaults \ 165 - -blockdev file,node-name=file-0,filename=$TEST_IMG.0,auto-read-only=on \ 166 - -blockdev qcow2,node-name=format-0,file=file-0,read-only=on \ 167 - -blockdev file,node-name=file-1,filename=$TEST_IMG.1,auto-read-only=on \ 168 - -blockdev qcow2,node-name=format-1,file=file-1,read-only=on,backing=format-0 \ 169 - -blockdev file,node-name=file-2,filename=$TEST_IMG.2,auto-read-only=on \ 170 - -blockdev qcow2,node-name=format-2,file=file-2,read-only=on,backing=format-1 \ 171 - -blockdev file,node-name=file-3,filename=$TEST_IMG.3,auto-read-only=on \ 172 - -blockdev qcow2,node-name=format-3,file=file-3,read-only=on,backing=format-2 \ 173 - -blockdev file,node-name=file-4,filename=$TEST_IMG.4,auto-read-only=on \ 174 - -blockdev qcow2,node-name=format-4,file=file-4,read-only=on,backing=format-3 | 175 - _filter_qmp 176 - 177 147 # success, all done 178 148 echo "*** done" 179 149 rm -f $seq.full
-20
tests/qemu-iotests/232.out
··· 56 56 QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied 57 57 node0: TEST_DIR/t.IMGFMT (file) 58 58 QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0: Could not open 'TEST_DIR/t.IMGFMT': Permission denied 59 - 60 - === Try commit to backing file with auto-read-only === 61 - 62 - Formatting 'TEST_DIR/t.IMGFMT.0', fmt=IMGFMT size=134217728 63 - Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=134217728 64 - Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728 65 - Formatting 'TEST_DIR/t.IMGFMT.3', fmt=IMGFMT size=134217728 66 - Formatting 'TEST_DIR/t.IMGFMT.4', fmt=IMGFMT size=134217728 67 - QMP_VERSION 68 - {"return": {}} 69 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} 70 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} 71 - {"return": {}} 72 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} 73 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} 74 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 134217728, "offset": 134217728, "speed": 0, "type": "commit"}} 75 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} 76 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} 77 - {"return": {}} 78 - {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} 79 59 *** done
+79
tests/qemu-iotests/247
··· 1 + #!/usr/bin/env bash 2 + # 3 + # Test for auto-read-only with commit block job 4 + # 5 + # Copyright (C) 2019 Red Hat, Inc. 6 + # 7 + # This program is free software; you can redistribute it and/or modify 8 + # it under the terms of the GNU General Public License as published by 9 + # the Free Software Foundation; either version 2 of the License, or 10 + # (at your option) any later version. 11 + # 12 + # This program is distributed in the hope that it will be useful, 13 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + # GNU General Public License for more details. 16 + # 17 + # You should have received a copy of the GNU General Public License 18 + # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 + # 20 + 21 + # creator 22 + owner=kwolf@redhat.com 23 + 24 + seq=`basename $0` 25 + echo "QA output created by $seq" 26 + 27 + status=1 # failure is the default! 28 + 29 + _cleanup() 30 + { 31 + _cleanup_test_img 32 + rm -f $TEST_IMG.[01234] 33 + } 34 + trap "_cleanup; exit \$status" 0 1 2 3 15 35 + 36 + # get standard environment, filters and checks 37 + . ./common.rc 38 + . ./common.filter 39 + 40 + # Requires backing files and .bdrv_change_backing_file support 41 + _supported_fmt qcow2 qed 42 + _supported_proto file 43 + _supported_os Linux 44 + 45 + size=128M 46 + 47 + echo 48 + echo "=== Try commit to backing file with auto-read-only ===" 49 + echo 50 + TEST_IMG="$TEST_IMG.0" _make_test_img $size 51 + TEST_IMG="$TEST_IMG.1" _make_test_img $size 52 + TEST_IMG="$TEST_IMG.2" _make_test_img $size 53 + TEST_IMG="$TEST_IMG.3" _make_test_img $size 54 + TEST_IMG="$TEST_IMG.4" _make_test_img $size 55 + 56 + (cat <<EOF 57 + {"execute":"qmp_capabilities"} 58 + {"execute":"block-commit", 59 + "arguments":{"device":"format-4", "top-node": "format-2", "base-node":"format-0", "job-id":"job0"}} 60 + EOF 61 + sleep 1 62 + echo '{"execute":"quit"}' 63 + ) | $QEMU -qmp stdio -nographic -nodefaults \ 64 + -blockdev file,node-name=file-0,filename=$TEST_IMG.0,auto-read-only=on \ 65 + -blockdev $IMGFMT,node-name=format-0,file=file-0,read-only=on \ 66 + -blockdev file,node-name=file-1,filename=$TEST_IMG.1,auto-read-only=on \ 67 + -blockdev $IMGFMT,node-name=format-1,file=file-1,read-only=on,backing=format-0 \ 68 + -blockdev file,node-name=file-2,filename=$TEST_IMG.2,auto-read-only=on \ 69 + -blockdev $IMGFMT,node-name=format-2,file=file-2,read-only=on,backing=format-1 \ 70 + -blockdev file,node-name=file-3,filename=$TEST_IMG.3,auto-read-only=on \ 71 + -blockdev $IMGFMT,node-name=format-3,file=file-3,read-only=on,backing=format-2 \ 72 + -blockdev file,node-name=file-4,filename=$TEST_IMG.4,auto-read-only=on \ 73 + -blockdev $IMGFMT,node-name=format-4,file=file-4,read-only=on,backing=format-3 | 74 + _filter_qmp 75 + 76 + # success, all done 77 + echo "*** done" 78 + rm -f $seq.full 79 + status=0
+22
tests/qemu-iotests/247.out
··· 1 + QA output created by 247 2 + 3 + === Try commit to backing file with auto-read-only === 4 + 5 + Formatting 'TEST_DIR/t.IMGFMT.0', fmt=IMGFMT size=134217728 6 + Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=134217728 7 + Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728 8 + Formatting 'TEST_DIR/t.IMGFMT.3', fmt=IMGFMT size=134217728 9 + Formatting 'TEST_DIR/t.IMGFMT.4', fmt=IMGFMT size=134217728 10 + QMP_VERSION 11 + {"return": {}} 12 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}} 13 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}} 14 + {"return": {}} 15 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}} 16 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}} 17 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 134217728, "offset": 134217728, "speed": 0, "type": "commit"}} 18 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}} 19 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}} 20 + {"return": {}} 21 + {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} 22 + *** done
+1
tests/qemu-iotests/group
··· 245 245 244 rw auto quick 246 246 245 rw auto 247 247 246 rw auto quick 248 + 247 rw auto quick