s390x: vmstatify config migration for virtio-ccw
[qemu.git] / tests / qemu-iotests / 024
blobe0d77ce2f5c64b8e3b6013136f8b32c71473e85c
1 #!/bin/bash
3 # Rebasing COW images
5 # Copyright (C) 2009 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 here=`pwd`
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
33 rm -f "$TEST_DIR/t.$IMGFMT.base_old"
34 rm -f "$TEST_DIR/t.$IMGFMT.base_new"
36 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
39 . ./common.rc
40 . ./common.filter
41 . ./common.pattern
43 # Currently only qcow2 and qed support rebasing
44 _supported_fmt qcow2 qed
45 _supported_proto file
46 _supported_os Linux
48 CLUSTER_SIZE=65536
50 # Cluster allocations to be tested:
52 # Backing (old) 11 -- 11 -- 11 -- 11 --
53 # Backing (new) 22 22 -- -- 22 22 -- --
54 # COW image 33 33 33 33 -- -- -- --
56 # The pattern is written twice to have both an alloc -> non-alloc and a
57 # non-alloc -> alloc transition in the COW image.
59 echo "Creating backing file"
60 echo
62 TEST_IMG_SAVE="$TEST_IMG"
63 TEST_IMG="$TEST_IMG.base_old"
65 _make_test_img 1G
66 io_pattern writev 0 $CLUSTER_SIZE $((2 * CLUSTER_SIZE)) 8 0x11
68 TEST_IMG="$TEST_IMG_SAVE.base_new"
70 echo "Creating new backing file"
71 echo
73 _make_test_img 1G
74 io_pattern writev 0 $((2 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 4 0x22
77 TEST_IMG="$TEST_IMG_SAVE"
79 echo "Creating COW image"
80 echo
82 _make_test_img -b "$TEST_IMG.base_old" 1G
83 io_pattern writev 0 $((4 * CLUSTER_SIZE)) 0 1 0x33
84 io_pattern writev $((8 * CLUSTER_SIZE)) $((4 * CLUSTER_SIZE)) 0 1 0x33
86 echo "Read before the rebase to make sure everything is set up correctly"
87 echo
88 io_pattern readv $((0 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
89 io_pattern readv $((1 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
90 io_pattern readv $((2 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
91 io_pattern readv $((3 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
92 io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
93 io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
94 io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
95 io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
96 io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
97 io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
98 io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
99 io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
100 io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
101 io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
102 io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
103 io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
105 echo
106 echo Rebase and test again
107 echo
108 $QEMU_IMG rebase -b "$TEST_IMG.base_new" "$TEST_IMG"
109 io_pattern readv $((0 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
110 io_pattern readv $((1 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
111 io_pattern readv $((2 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
112 io_pattern readv $((3 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
113 io_pattern readv $((4 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
114 io_pattern readv $((5 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
115 io_pattern readv $((6 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
116 io_pattern readv $((7 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
117 io_pattern readv $((8 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
118 io_pattern readv $((9 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
119 io_pattern readv $((10 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
120 io_pattern readv $((11 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x33
121 io_pattern readv $((12 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
122 io_pattern readv $((13 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
123 io_pattern readv $((14 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x11
124 io_pattern readv $((15 * CLUSTER_SIZE)) $CLUSTER_SIZE 0 1 0x00
127 # success, all done
128 echo "*** done"
129 rm -f $seq.full
130 status=0