mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
Block layer patches
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJauQSdAAoJEH8JsnLIjy/WkwMQAKV8ne1AmBygQFxyZdXy+hrv ZAU7xdm35rvN/gRHSHCinyRKVa2vXU4+9F79FxdVuTJwGDOaTQHADL0lZN4USzfY dZKrqWn6ExZjKDl/iJPA7qpRyIzhwK83ZhcQSJS/HUertOH7ga+bkgePAN15iyiK Jw4li6s2ZBSBmg0UgSg5YAcEaG3RxYfVzmLgpPCMMPkZZzkKXStiPkX/gPdyYPyr 666PLgA6O7U0rr6Lk5ALkNQwT81rZMO8YjENwmmKkzHnUsNnezGsc0OB8iXzlgWQ wh9SFAVtRl9xOz00t0ZX1U3eMzsAARz/sYG3dvYioyMtJhGj8AFLUx9DIVlcQbXG kyMFFKt9L2z9rj3HxulWkefLTFq9i2GA/GS36nJx/UjPxjh6AfXSDPjy1esiOlq+ TiTvUsBvJM6VHxj/qXLimTeT9gYF4ysmMyzSYJHj8XTgh6KoLq4Nc8/VpL9FoGjQ 4/3a08YzIQ/C2wJcsCl5SYKH9XiDQcxPPZ1pgxFxtkJM9vDjmGrbTuluZFB++vxP JZHJpMZQA9TncZQGnX/RWD+qkk/rP4NZ2YUlfxwHRV7sggi3P+Cz/WDwi3hZImYA rOXPv/IdzDFffzxINhmEjEUkatljJn5V4x/J+1nnEbNeioskFhdlaXHWMeU9Q12S UVV7fMvklUZ3Lu8Xc7kf =rvhx -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Mon 26 Mar 2018 15:33:01 BST # gpg: using RSA key 7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: qemu-iotests: Test vhdx image creation with QMP vhdx: Check for 4 GB maximum log size on creation vhdx: Don't use error_setg_errno() with constant errno vhdx: Require power-of-two block size on create qemu-iotests: Test parallels image creation with QMP parallels: Check maximum cluster size on create qemu-iotests: Test invalid resize on luks luks: Turn another invalid assertion into check qemu-iotests: Enable 025 for luks qemu-iotests: Test vdi image creation with QMP vdi: Fix build with CONFIG_VDI_DEBUG vdi: Change 'static' create option to 'preallocation' in QMP qcow2: Reset free_cluster_index when allocating a new refcount block include/block/block_int: Document protocol related functions block/blkreplay: Remove protocol-related fields block/throttle: Remove protocol-related fields block/quorum: Remove protocol-related fields block/replication: Remove protocol_name field iotests: 163 is not quick Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
62a2b55e8d
25 changed files with 1424 additions and 38 deletions
|
@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
|
|||
. ./common.filter
|
||||
. ./common.pattern
|
||||
|
||||
_supported_fmt raw qcow2 qed
|
||||
_supported_fmt raw qcow2 qed luks
|
||||
_supported_proto file sheepdog rbd nfs
|
||||
_supported_os Linux
|
||||
|
||||
|
@ -62,6 +62,13 @@ length
|
|||
EOF
|
||||
_check_test_img
|
||||
|
||||
# bdrv_truncate() doesn't zero the new space, so we need to do that explicitly.
|
||||
# We still want to test automatic zeroing for other formats even though
|
||||
# bdrv_truncate() doesn't guarantee it.
|
||||
if [ "$IMGFMT" == "luks" ]; then
|
||||
$QEMU_IO -c "write -z $small_size $((big_size - small_size))" "$TEST_IMG" > /dev/null
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=== Verifying image size after reopen"
|
||||
$QEMU_IO -c "length" "$TEST_IMG"
|
||||
|
|
|
@ -533,7 +533,7 @@ Failed to flush the L2 table cache: No space left on device
|
|||
Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
11 leaked clusters were found on the image.
|
||||
10 leaked clusters were found on the image.
|
||||
This means waste of disk space, but no harm to data.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
|
@ -561,7 +561,7 @@ Failed to flush the L2 table cache: No space left on device
|
|||
Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
11 leaked clusters were found on the image.
|
||||
10 leaked clusters were found on the image.
|
||||
This means waste of disk space, but no harm to data.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
|
@ -589,7 +589,7 @@ Failed to flush the L2 table cache: No space left on device
|
|||
Failed to flush the refcount block cache: No space left on device
|
||||
write failed: No space left on device
|
||||
|
||||
11 leaked clusters were found on the image.
|
||||
10 leaked clusters were found on the image.
|
||||
This means waste of disk space, but no harm to data.
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
|
||||
|
||||
|
|
|
@ -93,6 +93,26 @@ $QEMU_IO -c 'write 63M 130K' "$TEST_IMG" | _filter_qemu_io
|
|||
|
||||
_check_test_img
|
||||
|
||||
echo
|
||||
echo '=== Allocating a new refcount block must not leave holes in the image ==='
|
||||
echo
|
||||
|
||||
IMGOPTS='cluster_size=512,refcount_bits=16' _make_test_img 1M
|
||||
|
||||
# This results in an image with 256 used clusters: the qcow2 header,
|
||||
# the refcount table, one refcount block, the L1 table, four L2 tables
|
||||
# and 248 data clusters
|
||||
$QEMU_IO -c 'write 0 124k' "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# 256 clusters of 512 bytes each give us a 128K image
|
||||
stat -c "size=%s (expected 131072)" $TEST_IMG
|
||||
|
||||
# All 256 entries of the refcount block are used, so writing a new
|
||||
# data cluster also allocates a new refcount block
|
||||
$QEMU_IO -c 'write 124k 512' "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# Two more clusters, the image size should be 129K now
|
||||
stat -c "size=%s (expected 132096)" $TEST_IMG
|
||||
|
||||
# success, all done
|
||||
echo
|
||||
|
|
|
@ -20,4 +20,14 @@ wrote 133120/133120 bytes at offset 66060288
|
|||
130 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
No errors were found on the image.
|
||||
|
||||
=== Allocating a new refcount block must not leave holes in the image ===
|
||||
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576
|
||||
wrote 126976/126976 bytes at offset 0
|
||||
124 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
size=131072 (expected 131072)
|
||||
wrote 512/512 bytes at offset 126976
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
size=132096 (expected 132096)
|
||||
|
||||
*** done
|
||||
|
|
|
@ -204,6 +204,43 @@ run_qemu -blockdev driver=file,filename="$TEST_IMG_FILE",node-name=node0 \
|
|||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Resize image with invalid sizes ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG_FILE",node-name=node0 \
|
||||
-blockdev driver=luks,file=node0,key-secret=keysec0,node-name=node1 \
|
||||
-object secret,id=keysec0,data="foo" <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "block_resize",
|
||||
"arguments": {
|
||||
"node-name": "node1",
|
||||
"size": 9223372036854775296
|
||||
}
|
||||
}
|
||||
{ "execute": "block_resize",
|
||||
"arguments": {
|
||||
"node-name": "node1",
|
||||
"size": 9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "block_resize",
|
||||
"arguments": {
|
||||
"node-name": "node1",
|
||||
"size": 18446744073709551104
|
||||
}
|
||||
}
|
||||
{ "execute": "block_resize",
|
||||
"arguments": {
|
||||
"node-name": "node1",
|
||||
"size": -9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
|
|
|
@ -133,4 +133,20 @@ QMP_VERSION
|
|||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Resize image with invalid sizes ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0 -blockdev driver=IMGFMT,file=node0,key-secret=keysec0,node-name=node1 -object secret,id=keysec0,data=foo
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "The requested file size is too large"}}
|
||||
{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'size', expected: integer"}}
|
||||
{"error": {"class": "GenericError", "desc": "Invalid parameter type for 'size', expected: integer"}}
|
||||
{"error": {"class": "GenericError", "desc": "Parameter 'size' expects a >0 size"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "key-secret": "keysec0"}
|
||||
file format: IMGFMT
|
||||
virtual size: 0 (0 bytes)
|
||||
*** done
|
||||
|
|
246
tests/qemu-iotests/211
Executable file
246
tests/qemu-iotests/211
Executable file
|
@ -0,0 +1,246 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Test VDI and file image creation
|
||||
#
|
||||
# Copyright (C) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# creator
|
||||
owner=kwolf@redhat.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
status=1 # failure is the default!
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt vdi
|
||||
_supported_proto file
|
||||
_supported_os Linux
|
||||
|
||||
function do_run_qemu()
|
||||
{
|
||||
echo Testing: "$@"
|
||||
$QEMU -nographic -qmp stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
|
||||
| _filter_qemu | _filter_imgfmt \
|
||||
| _filter_actual_image_size
|
||||
}
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (defaults) ==="
|
||||
echo
|
||||
|
||||
size=$((128 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "blockdev-add",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"node-name": "imgfile",
|
||||
"filename": "$TEST_IMG"
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "imgfile",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (explicit defaults) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((64 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"preallocation": "off"
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (with non-default options) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((32 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"preallocation": "metadata"
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo "=== Invalid BlockdevRef ==="
|
||||
echo
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "this doesn't exist",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Zero size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Maximum size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 562949819203584
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Invalid sizes ==="
|
||||
echo
|
||||
|
||||
# TODO Negative image sizes aren't handled correctly, but this is a problem
|
||||
# with QAPI's implementation of the 'size' type and affects other commands as
|
||||
# well. Once this is fixed, we may want to add a test case here.
|
||||
|
||||
# 1. 2^64 - 512
|
||||
# 2. 2^63 = 8 EB (qemu-img enforces image sizes less than this)
|
||||
# 3. 0x1fffff8000001 (one byte more than maximum image size for VDI)
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 18446744073709551104
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 562949819203585
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
97
tests/qemu-iotests/211.out
Normal file
97
tests/qemu-iotests/211.out
Normal file
|
@ -0,0 +1,97 @@
|
|||
QA output created by 211
|
||||
|
||||
=== Successful image creation (defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 128M (134217728 bytes)
|
||||
[{ "start": 0, "length": 134217728, "depth": 0, "zero": true, "data": false}]
|
||||
|
||||
=== Successful image creation (explicit defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 64M (67108864 bytes)
|
||||
[{ "start": 0, "length": 67108864, "depth": 0, "zero": true, "data": false}]
|
||||
|
||||
=== Successful image creation (with non-default options) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 32M (33554432 bytes)
|
||||
[{ "start": 0, "length": 3072, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
|
||||
{ "start": 3072, "length": 33551360, "depth": 0, "zero": true, "data": true, "offset": OFFSET}]
|
||||
|
||||
=== Invalid BlockdevRef ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Cannot find device=this doesn't exist nor node_name=this doesn't exist"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Zero size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 0 (0 bytes)
|
||||
|
||||
=== Maximum size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 512T (562949819203584 bytes)
|
||||
|
||||
=== Invalid sizes ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Unsupported VDI image size (size is 0xfffffffffffffe00, max supported is 0x1fffff8000000)"}}
|
||||
{"error": {"class": "GenericError", "desc": "Unsupported VDI image size (size is 0x8000000000000000, max supported is 0x1fffff8000000)"}}
|
||||
{"error": {"class": "GenericError", "desc": "Unsupported VDI image size (size is 0x1fffff8000001, max supported is 0x1fffff8000000)"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
*** done
|
326
tests/qemu-iotests/212
Executable file
326
tests/qemu-iotests/212
Executable file
|
@ -0,0 +1,326 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Test parallels and file image creation
|
||||
#
|
||||
# Copyright (C) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# creator
|
||||
owner=kwolf@redhat.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
status=1 # failure is the default!
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt parallels
|
||||
_supported_proto file
|
||||
_supported_os Linux
|
||||
|
||||
function do_run_qemu()
|
||||
{
|
||||
echo Testing: "$@"
|
||||
$QEMU -nographic -qmp stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
|
||||
| _filter_qemu | _filter_imgfmt \
|
||||
| _filter_actual_image_size
|
||||
}
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (defaults) ==="
|
||||
echo
|
||||
|
||||
size=$((128 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "blockdev-add",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"node-name": "imgfile",
|
||||
"filename": "$TEST_IMG"
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "imgfile",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (explicit defaults) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((64 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"cluster-size": 1048576
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (with non-default options) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((32 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"cluster-size": 65536
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Invalid BlockdevRef ==="
|
||||
echo
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "this doesn't exist",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Zero size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Maximum size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 4503599627369984
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Invalid sizes ==="
|
||||
echo
|
||||
|
||||
# TODO Negative image sizes aren't handled correctly, but this is a problem
|
||||
# with QAPI's implementation of the 'size' type and affects other commands as
|
||||
# well. Once this is fixed, we may want to add a test case here.
|
||||
|
||||
# 1. Misaligned image size
|
||||
# 2. 2^64 - 512
|
||||
# 3. 2^63 = 8 EB (qemu-img enforces image sizes less than this)
|
||||
# 4. 2^63 - 512 (generally valid, but with the image header the file will
|
||||
# exceed 63 bits)
|
||||
# 5. 2^52 (512 bytes more than maximum image size)
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 1234
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 18446744073709551104
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 9223372036854775296
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 4503599627370497
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Invalid cluster size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 1234
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 128
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 4294967296
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 18446744073709551104
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"cluster-size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 281474976710656,
|
||||
"cluster-size": 512
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
111
tests/qemu-iotests/212.out
Normal file
111
tests/qemu-iotests/212.out
Normal file
|
@ -0,0 +1,111 @@
|
|||
QA output created by 212
|
||||
|
||||
=== Successful image creation (defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 128M (134217728 bytes)
|
||||
|
||||
=== Successful image creation (explicit defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 64M (67108864 bytes)
|
||||
|
||||
=== Successful image creation (with non-default options) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 32M (33554432 bytes)
|
||||
|
||||
=== Invalid BlockdevRef ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Cannot find device=this doesn't exist nor node_name=this doesn't exist"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Zero size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 0 (0 bytes)
|
||||
|
||||
=== Maximum size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 4096T (4503599627369984 bytes)
|
||||
|
||||
=== Invalid sizes ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size must be a multiple of 512 bytes"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Invalid cluster size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Cluster size must be a multiple of 512 bytes"}}
|
||||
{"error": {"class": "GenericError", "desc": "Cluster size must be a multiple of 512 bytes"}}
|
||||
{"error": {"class": "GenericError", "desc": "Cluster size is too large"}}
|
||||
{"error": {"class": "GenericError", "desc": "Cluster size is too large"}}
|
||||
{"error": {"class": "GenericError", "desc": "Cluster size is too large"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size is too large for this cluster size"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
*** done
|
349
tests/qemu-iotests/213
Executable file
349
tests/qemu-iotests/213
Executable file
|
@ -0,0 +1,349 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Test vhdx and file image creation
|
||||
#
|
||||
# Copyright (C) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# creator
|
||||
owner=kwolf@redhat.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
here=`pwd`
|
||||
status=1 # failure is the default!
|
||||
|
||||
# get standard environment, filters and checks
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt vhdx
|
||||
_supported_proto file
|
||||
_supported_os Linux
|
||||
|
||||
function do_run_qemu()
|
||||
{
|
||||
echo Testing: "$@"
|
||||
$QEMU -nographic -qmp stdio -serial none "$@"
|
||||
echo
|
||||
}
|
||||
|
||||
function run_qemu()
|
||||
{
|
||||
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
|
||||
| _filter_qemu | _filter_imgfmt \
|
||||
| _filter_actual_image_size
|
||||
}
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (defaults) ==="
|
||||
echo
|
||||
|
||||
size=$((128 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "blockdev-add",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"node-name": "imgfile",
|
||||
"filename": "$TEST_IMG"
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "imgfile",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (explicit defaults) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((64 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"log-size": 1048576,
|
||||
"block-size": 8388608,
|
||||
"subformat": "dynamic",
|
||||
"block-state-zero": true
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Successful image creation (with non-default options) ==="
|
||||
echo
|
||||
|
||||
# Choose a different size to show that we got a new image
|
||||
size=$((32 * 1024 * 1024))
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": {
|
||||
"driver": "file",
|
||||
"filename": "$TEST_IMG"
|
||||
},
|
||||
"size": $size,
|
||||
"log-size": 8388608,
|
||||
"block-size": 268435456,
|
||||
"subformat": "fixed",
|
||||
"block-state-zero": false
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info --format-specific | _filter_img_info --format-specific
|
||||
|
||||
echo
|
||||
echo "=== Invalid BlockdevRef ==="
|
||||
echo
|
||||
|
||||
run_qemu <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "this doesn't exist",
|
||||
"size": $size
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Zero size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Maximum size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 70368744177664
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
_img_info | _filter_img_info
|
||||
|
||||
echo
|
||||
echo "=== Invalid sizes ==="
|
||||
echo
|
||||
|
||||
# TODO Negative image sizes aren't handled correctly, but this is a problem
|
||||
# with QAPI's implementation of the 'size' type and affects other commands as
|
||||
# well. Once this is fixed, we may want to add a test case here.
|
||||
|
||||
# 1. 2^64 - 512
|
||||
# 2. 2^63 = 8 EB (qemu-img enforces image sizes less than this)
|
||||
# 3. 2^63 - 512 (generally valid, but with the image header the file will
|
||||
# exceed 63 bits)
|
||||
# 4. 2^46 + 1 (one byte more than maximum image size)
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 18446744073709551104
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 9223372036854775808
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 9223372036854775296
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 70368744177665
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Invalid block size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"block-size": 1234567
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"block-size": 128
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"block-size": 3145728
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"block-size": 536870912
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"block-size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
echo
|
||||
echo "=== Invalid log size ==="
|
||||
echo
|
||||
|
||||
run_qemu -blockdev driver=file,filename="$TEST_IMG",node-name=node0 <<EOF
|
||||
{ "execute": "qmp_capabilities" }
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"log-size": 1234567
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"log-size": 128
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"log-size": 4294967296
|
||||
}
|
||||
}
|
||||
{ "execute": "x-blockdev-create",
|
||||
"arguments": {
|
||||
"driver": "$IMGFMT",
|
||||
"file": "node0",
|
||||
"size": 67108864,
|
||||
"log-size": 0
|
||||
}
|
||||
}
|
||||
{ "execute": "quit" }
|
||||
EOF
|
||||
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
121
tests/qemu-iotests/213.out
Normal file
121
tests/qemu-iotests/213.out
Normal file
|
@ -0,0 +1,121 @@
|
|||
QA output created by 213
|
||||
|
||||
=== Successful image creation (defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 128M (134217728 bytes)
|
||||
|
||||
=== Successful image creation (explicit defaults) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 64M (67108864 bytes)
|
||||
|
||||
=== Successful image creation (with non-default options) ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 32M (33554432 bytes)
|
||||
|
||||
=== Invalid BlockdevRef ===
|
||||
|
||||
Testing:
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Cannot find device=this doesn't exist nor node_name=this doesn't exist"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Zero size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 0 (0 bytes)
|
||||
|
||||
=== Maximum size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 64T (70368744177664 bytes)
|
||||
|
||||
=== Invalid sizes ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size too large; max of 64TB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size too large; max of 64TB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size too large; max of 64TB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Image size too large; max of 64TB"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Invalid block size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Block size must be a multiple of 1 MB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Block size must be a multiple of 1 MB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Block size must be a power of two"}}
|
||||
{"error": {"class": "GenericError", "desc": "Block size must not exceed 268435456"}}
|
||||
{"error": {"class": "GenericError", "desc": "Block size must be a multiple of 1 MB"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
|
||||
=== Invalid log size ===
|
||||
|
||||
Testing: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0
|
||||
QMP_VERSION
|
||||
{"return": {}}
|
||||
{"error": {"class": "GenericError", "desc": "Log size must be a multiple of 1 MB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Log size must be a multiple of 1 MB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Log size must be smaller than 4 GB"}}
|
||||
{"error": {"class": "GenericError", "desc": "Log size must be a multiple of 1 MB"}}
|
||||
{"return": {}}
|
||||
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
|
||||
|
||||
*** done
|
|
@ -167,7 +167,7 @@
|
|||
159 rw auto quick
|
||||
160 rw auto quick
|
||||
162 auto quick
|
||||
163 rw auto quick
|
||||
163 rw auto
|
||||
165 rw auto quick
|
||||
169 rw auto quick
|
||||
170 rw auto quick
|
||||
|
@ -209,3 +209,6 @@
|
|||
208 rw auto quick
|
||||
209 rw auto quick
|
||||
210 rw auto
|
||||
211 rw auto quick
|
||||
212 rw auto quick
|
||||
213 rw auto quick
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue