]>
Commit | Line | Data |
---|---|---|
11a82d14 | 1 | #!/usr/bin/env bash |
8983b670 JC |
2 | # Check live snapshot, followed by active commit, and another snapshot. |
3 | # | |
4 | # This test is to catch the error case of BZ #1300209: | |
5 | # https://bugzilla.redhat.com/show_bug.cgi?id=1300209 | |
6 | # | |
7 | # Copyright (C) 2016 Red Hat, Inc. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; either version 2 of the License, or | |
12 | # (at your option) any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | # | |
22 | ||
23 | # creator | |
24 | owner=jcody@redhat.com | |
25 | ||
26 | seq=`basename $0` | |
27 | echo "QA output created by $seq" | |
28 | ||
8983b670 JC |
29 | status=1 # failure is the default! |
30 | ||
31 | TMP_SNAP1=${TEST_DIR}/tmp.qcow2 | |
32 | TMP_SNAP2=${TEST_DIR}/tmp2.qcow2 | |
33 | ||
34 | _cleanup() | |
35 | { | |
36 | _cleanup_qemu | |
37 | rm -f "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}" | |
38 | } | |
39 | ||
40 | trap "_cleanup; exit \$status" 0 1 2 3 15 | |
41 | ||
42 | # get standard environment, filters and checks | |
43 | . ./common.rc | |
44 | . ./common.filter | |
45 | . ./common.qemu | |
46 | ||
47 | _supported_fmt qcow2 | |
48 | _supported_proto file | |
49 | _supported_os Linux | |
50 | ||
51 | size=512M | |
52 | ||
53 | _make_test_img $size | |
54 | ||
55 | echo | |
56 | echo === Launching QEMU === | |
57 | echo | |
58 | ||
59 | qemu_comm_method="qmp" | |
60 | _launch_qemu -drive file="${TEST_IMG}",if=virtio | |
61 | h=$QEMU_HANDLE | |
62 | ||
63 | ||
64 | echo | |
65 | echo === Performing Live Snapshot 1 === | |
66 | echo | |
67 | ||
68 | _send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" "return" | |
69 | ||
70 | ||
71 | # First live snapshot, new overlay as active layer | |
72 | _send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync', | |
73 | 'arguments': { | |
74 | 'device': 'virtio0', | |
75 | 'snapshot-file':'${TMP_SNAP1}', | |
76 | 'format': 'qcow2' | |
77 | } | |
78 | }" "return" | |
79 | ||
80 | echo | |
81 | echo === Performing block-commit on active layer === | |
82 | echo | |
83 | ||
84 | # Block commit on active layer, push the new overlay into base | |
85 | _send_qemu_cmd $h "{ 'execute': 'block-commit', | |
86 | 'arguments': { | |
87 | 'device': 'virtio0' | |
88 | } | |
89 | }" "READY" | |
90 | ||
91 | _send_qemu_cmd $h "{ 'execute': 'block-job-complete', | |
92 | 'arguments': { | |
93 | 'device': 'virtio0' | |
94 | } | |
1dac83f1 | 95 | }" '"status": "null"' |
8983b670 JC |
96 | |
97 | echo | |
98 | echo === Performing Live Snapshot 2 === | |
99 | echo | |
100 | ||
101 | # New live snapshot, new overlays as active layer | |
102 | _send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync', | |
103 | 'arguments': { | |
104 | 'device': 'virtio0', | |
105 | 'snapshot-file':'${TMP_SNAP2}', | |
106 | 'format': 'qcow2' | |
107 | } | |
108 | }" "return" | |
109 | ||
110 | # success, all done | |
111 | echo "*** done" | |
112 | rm -f $seq.full | |
113 | status=0 |