]> Git Repo - qemu.git/blame - tests/qemu-iotests/144
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
[qemu.git] / tests / qemu-iotests / 144
CommitLineData
8983b670
JC
1#!/bin/bash
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[email protected]
25
26seq=`basename $0`
27echo "QA output created by $seq"
28
29here=`pwd`
30status=1 # failure is the default!
31
32TMP_SNAP1=${TEST_DIR}/tmp.qcow2
33TMP_SNAP2=${TEST_DIR}/tmp2.qcow2
34
35_cleanup()
36{
37 _cleanup_qemu
38 rm -f "${TEST_IMG}" "${TMP_SNAP1}" "${TMP_SNAP2}"
39}
40
41trap "_cleanup; exit \$status" 0 1 2 3 15
42
43# get standard environment, filters and checks
44. ./common.rc
45. ./common.filter
46. ./common.qemu
47
48_supported_fmt qcow2
49_supported_proto file
50_supported_os Linux
51
52size=512M
53
54_make_test_img $size
55
56echo
57echo === Launching QEMU ===
58echo
59
60qemu_comm_method="qmp"
61_launch_qemu -drive file="${TEST_IMG}",if=virtio
62h=$QEMU_HANDLE
63
64
65echo
66echo === Performing Live Snapshot 1 ===
67echo
68
69_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" "return"
70
71
72# First live snapshot, new overlay as active layer
73_send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync',
74 'arguments': {
75 'device': 'virtio0',
76 'snapshot-file':'${TMP_SNAP1}',
77 'format': 'qcow2'
78 }
79 }" "return"
80
81echo
82echo === Performing block-commit on active layer ===
83echo
84
85# Block commit on active layer, push the new overlay into base
86_send_qemu_cmd $h "{ 'execute': 'block-commit',
87 'arguments': {
88 'device': 'virtio0'
89 }
90 }" "READY"
91
92_send_qemu_cmd $h "{ 'execute': 'block-job-complete',
93 'arguments': {
94 'device': 'virtio0'
95 }
96 }" "COMPLETED"
97
98echo
99echo === Performing Live Snapshot 2 ===
100echo
101
102# New live snapshot, new overlays as active layer
103_send_qemu_cmd $h "{ 'execute': 'blockdev-snapshot-sync',
104 'arguments': {
105 'device': 'virtio0',
106 'snapshot-file':'${TMP_SNAP2}',
107 'format': 'qcow2'
108 }
109 }" "return"
110
111# success, all done
112echo "*** done"
113rm -f $seq.full
114status=0
This page took 0.087011 seconds and 4 git commands to generate.