]> Git Repo - qemu.git/blob - tests/qemu-iotests/173
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2017-02-12' into staging
[qemu.git] / tests / qemu-iotests / 173
1 #!/bin/bash
2 #
3 # Test QAPI commands looking up protocol based images with relative
4 # filename backing strings
5 #
6 # Copyright (C) 2017 Red Hat, Inc.
7 #
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.
12 #
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.
17 #
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/>.
20 #
21 # creator
22 [email protected]
23
24 seq=`basename $0`
25 echo "QA output created by $seq"
26
27 here=`pwd`
28 status=1    # failure is the default!
29
30 _cleanup()
31 {
32     _cleanup_qemu
33     rm  -f "${QEMU_TEST_DIR}/image.base" "${QEMU_TEST_DIR}/image.snp1"
34     _cleanup_test_img
35 }
36 trap "_cleanup; exit \$status" 0 1 2 3 15
37
38 # get standard environment, filters and checks
39 . ./common.rc
40 . ./common.filter
41 . ./common.qemu
42
43 _supported_fmt qcow2
44 _supported_proto nfs
45 _supported_os Linux
46
47 size=100M
48
49 BASE_IMG="${TEST_DIR}/image.base"
50 TOP_IMG="${TEST_DIR}/image.snp1"
51
52 TEST_IMG="${BASE_IMG}" _make_test_img $size
53
54 TEST_IMG="${TOP_IMG}" _make_test_img $size
55
56 echo
57 echo === Running QEMU, using block-stream to find backing image ===
58 echo
59
60 qemu_comm_method="qmp"
61 _launch_qemu -drive file="${BASE_IMG}",if=virtio,id=disk2
62 h=$QEMU_HANDLE
63
64 _send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" "return"
65
66 _send_qemu_cmd $h "{ 'arguments': {
67                         'device': 'disk2',
68                         'format': '${IMGFMT}',
69                         'mode': 'existing',
70                         'snapshot-file': '${TOP_IMG}',
71                         'snapshot-node-name': 'snp1'
72                      },
73                      'execute': 'blockdev-snapshot-sync'
74                    }" "return"
75
76
77 _send_qemu_cmd $h "{ 'arguments': {
78                         'backing-file': 'image.base',
79                         'device': 'disk2',
80                         'image-node-name': 'snp1'
81                      },
82                      'execute': 'change-backing-file'
83                    }" "return"
84
85 _send_qemu_cmd $h "{ 'arguments': {
86                         'base': '${BASE_IMG}',
87                         'device': 'disk2'
88                       },
89                       'execute': 'block-stream'
90                    }" "BLOCK_JOB_COMPLETED"
91
92 _cleanup_qemu
93
94 # success, all done
95 echo "*** done"
96 rm -f $seq.full
97 status=0
This page took 0.030315 seconds and 4 git commands to generate.