qemu-options: Replace the word 'blacklist'
[qemu/ar7.git] / tests / qemu-iotests / 267
blob2e2afdad9c57a2f4fadd7282368d81cb38a55f1b
1 #!/usr/bin/env bash
2 # group: rw auto quick snapshot
4 # Test which nodes are involved in internal snapshots
6 # Copyright (C) 2019 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # creator
23 owner=kwolf@redhat.com
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
33 rm -f "$SOCK_DIR/nbd"
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
38 . ./common.rc
39 . ./common.filter
41 _supported_fmt qcow2
42 _supported_proto file
43 _supported_os Linux
44 _require_drivers copy-on-read
46 # Internal snapshots are (currently) impossible with refcount_bits=1,
47 # and generally impossible with external data files
48 _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file
50 _require_devices virtio-blk
52 do_run_qemu()
54 echo Testing: "$@"
56 if ! test -t 0; then
57 while read cmd; do
58 echo $cmd
59 done
61 echo quit
62 ) | $QEMU -nographic -monitor stdio -nodefaults "$@"
63 echo
66 run_qemu()
68 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
69 _filter_generated_node_ids | _filter_imgfmt | _filter_vmstate_size
72 size=128M
74 run_test()
76 if [ -n "$BACKING_FILE" ]; then
77 _make_test_img -b "$BACKING_FILE" -F $IMGFMT $size
78 else
79 _make_test_img $size
81 printf "savevm snap0\ninfo snapshots\nloadvm snap0\n" | run_qemu "$@" | _filter_date
85 echo
86 echo "=== No block devices at all ==="
87 echo
89 run_test
91 echo
92 echo "=== -drive if=none ==="
93 echo
95 run_test -drive driver=file,file="$TEST_IMG",if=none
96 run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=none
97 run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=none -device virtio-blk,drive=none0
99 echo
100 echo "=== -drive if=virtio ==="
101 echo
103 run_test -drive driver=file,file="$TEST_IMG",if=virtio
104 run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=virtio
106 echo
107 echo "=== Simple -blockdev ==="
108 echo
110 run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file
111 run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \
112 -blockdev driver=$IMGFMT,file=file,node-name=fmt
113 run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \
114 -blockdev driver=raw,file=file,node-name=raw \
115 -blockdev driver=$IMGFMT,file=raw,node-name=fmt
117 echo
118 echo "=== -blockdev with a filter on top ==="
119 echo
121 run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \
122 -blockdev driver=$IMGFMT,file=file,node-name=fmt \
123 -blockdev driver=copy-on-read,file=fmt,node-name=filter
125 echo
126 echo "=== -blockdev with a backing file ==="
127 echo
129 TEST_IMG="$TEST_IMG.base" _make_test_img $size
131 BACKING_FILE="$TEST_IMG.base" \
132 run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
133 -blockdev driver=file,filename="$TEST_IMG",node-name=file \
134 -blockdev driver=$IMGFMT,file=file,backing=backing-file,node-name=fmt
136 BACKING_FILE="$TEST_IMG.base" \
137 run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
138 -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \
139 -blockdev driver=file,filename="$TEST_IMG",node-name=file \
140 -blockdev driver=$IMGFMT,file=file,backing=backing-fmt,node-name=fmt
142 # A snapshot should be present on the overlay, but not the backing file
143 echo Internal snapshots on overlay:
144 $QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
146 echo Internal snapshots on backing file:
147 $QEMU_IMG snapshot -l "$TEST_IMG.base" | _filter_date | _filter_vmstate_size
149 echo
150 echo "=== -blockdev with NBD server on the backing file ==="
151 echo
153 _make_test_img -b "$TEST_IMG.base" -F $IMGFMT $size
154 cat <<EOF |
155 nbd_server_start unix:$SOCK_DIR/nbd
156 nbd_server_add -w backing-fmt
157 savevm snap0
158 info snapshots
159 loadvm snap0
161 run_qemu -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \
162 -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \
163 -blockdev driver=file,filename="$TEST_IMG",node-name=file \
164 -blockdev driver=$IMGFMT,file=file,backing=backing-fmt,node-name=fmt |
165 _filter_date
167 # This time, a snapshot should be created on both files
168 echo Internal snapshots on overlay:
169 $QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
171 echo Internal snapshots on backing file:
172 $QEMU_IMG snapshot -l "$TEST_IMG.base" | _filter_date | _filter_vmstate_size
174 # success, all done
175 echo "*** done"
176 rm -f $seq.full
177 status=0