3 # Test vmdk backing file correlation
5 # Copyright (C) 2018 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/>.
22 owner
=mreitz@redhat.com
25 echo "QA output created by $seq"
27 status
=1 # failure is the default!
32 _rm_test_img
"$TEST_IMG.not_base"
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
41 # This tests vmdk-specific low-level functionality
45 _unsupported_imgopts
"subformat=monolithicFlat" \
46 "subformat=twoGbMaxExtentFlat" \
47 "subformat=twoGbMaxExtentSparse"
49 TEST_IMG
="$TEST_IMG.base" _make_test_img
1M
50 TEST_IMG
="$TEST_IMG.not_base" _make_test_img
1M
51 _make_test_img
-b "$TEST_IMG.base"
59 if [ -z "$backing" ]; then
65 echo "{ 'node-name': '$node_name',
69 'filename': '$filename'
71 'backing': $backing }"
74 overlay_opts
=$
(make_opts overlay
"$TEST_IMG" backing
)
75 base_opts
=$
(make_opts backing
"$TEST_IMG.base")
76 not_base_opts
=$
(make_opts backing
"$TEST_IMG.not_base")
78 not_vmdk_opts
="{ 'node-name': 'backing', 'driver': 'null-co' }"
81 echo '=== Testing fitting VMDK backing image ==='
84 qemu_comm_method
=monitor \
85 _launch_qemu
-blockdev "$base_opts" -blockdev "$overlay_opts"
87 # Should not return an error
88 _send_qemu_cmd
$QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'ops'
94 echo '=== Testing unrelated VMDK backing image ==='
97 qemu_comm_method
=monitor \
98 _launch_qemu
-blockdev "$not_base_opts" -blockdev "$overlay_opts"
100 # Should fail (gracefully)
101 _send_qemu_cmd
$QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed'
107 echo '=== Testing non-VMDK backing image ==='
110 # FIXME: This is the reason why we have to use two -blockdev
111 # invocations. You can only fully override the backing file options
112 # if you either specify a node reference (as done here) or the new
113 # options contain file.filename (which in this case they do not).
114 # In other cases, file.filename will be set to whatever the image
115 # header of the overlay contains (which we do not want). I consider
116 # this a FIXME because with -blockdev, you cannot specify "partial"
117 # options, so setting file.filename but leaving the rest as specified
118 # by the user does not make sense.
119 qemu_comm_method
=monitor \
120 _launch_qemu
-blockdev "$not_vmdk_opts" -blockdev "$overlay_opts"
122 # Should fail (gracefully)
123 _send_qemu_cmd
$QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed'