]>
Commit | Line | Data |
---|---|---|
11a82d14 | 1 | #!/usr/bin/env bash |
d1fde4ad JC |
2 | # |
3 | # Test for commit of larger active layer | |
4 | # | |
5 | # This tests live snapshots of images on a running QEMU instance, using | |
6 | # QMP commands. Both single disk snapshots, and transactional group | |
7 | # snapshots are performed. | |
8 | # | |
9 | # Copyright (C) 2014 Red Hat, Inc. | |
10 | # | |
11 | # This program is free software; you can redistribute it and/or modify | |
12 | # it under the terms of the GNU General Public License as published by | |
13 | # the Free Software Foundation; either version 2 of the License, or | |
14 | # (at your option) any later version. | |
15 | # | |
16 | # This program is distributed in the hope that it will be useful, | |
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | # GNU General Public License for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | # | |
24 | # creator | |
25 | [email protected] | |
26 | ||
27 | seq=`basename $0` | |
28 | echo "QA output created by $seq" | |
29 | ||
d1fde4ad JC |
30 | status=1 # failure is the default! |
31 | ||
32 | _cleanup() | |
33 | { | |
34 | _cleanup_qemu | |
35 | rm -f "${TEST_IMG}.base" "${TEST_IMG}.snp1" | |
36 | _cleanup_test_img | |
37 | } | |
38 | trap "_cleanup; exit \$status" 0 1 2 3 15 | |
39 | ||
40 | # get standard environment, filters and checks | |
41 | . ./common.rc | |
42 | . ./common.filter | |
43 | . ./common.qemu | |
44 | ||
45 | _supported_fmt qcow2 | |
46 | _supported_proto file | |
47 | _supported_os Linux | |
48 | ||
49 | size_smaller=5M | |
50 | size_larger=100M | |
51 | ||
61b42226 | 52 | TEST_IMG="$TEST_IMG.base" _make_test_img $size_smaller |
d1fde4ad | 53 | |
61b42226 | 54 | TEST_IMG="$TEST_IMG.snp1" _make_test_img -b "$TEST_IMG.base" $size_larger |
d1fde4ad JC |
55 | |
56 | _make_test_img -b "${TEST_IMG}.snp1" $size_larger | |
57 | ||
58 | echo | |
59 | echo "=== Base image info before commit and resize ===" | |
f943078e | 60 | TEST_IMG="${TEST_IMG}.base" _img_info | _filter_img_info |
d1fde4ad JC |
61 | |
62 | echo | |
63 | echo === Running QEMU Live Commit Test === | |
64 | echo | |
65 | ||
66 | qemu_comm_method="qmp" | |
67 | _launch_qemu -drive file="${TEST_IMG}",if=virtio,id=test | |
68 | h=$QEMU_HANDLE | |
69 | ||
70 | _send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" "return" | |
71 | ||
72 | _send_qemu_cmd $h "{ 'execute': 'block-commit', | |
73 | 'arguments': { 'device': 'test', | |
1dac83f1 | 74 | 'top': '"${TEST_IMG}.snp1"' } }" '"status": "null"' |
d1fde4ad | 75 | |
6ea66b59 FZ |
76 | _cleanup_qemu |
77 | ||
d1fde4ad JC |
78 | echo |
79 | echo "=== Base image info after commit and resize ===" | |
f943078e | 80 | TEST_IMG="${TEST_IMG}.base" _img_info | _filter_img_info |
d1fde4ad JC |
81 | |
82 | # success, all done | |
83 | echo "*** done" | |
84 | rm -f $seq.full | |
85 | status=0 |