Block patches
The following changes since commit 1a381811b495651ddfc2b50d7c8cfaaf375816b0:
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-s390-20140515' into staging (2014-05-15 18:56:08 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 465bee1da82e43f18d10c43cc7566d0284ad13a9:
block: optimize zero writes with bdrv_write_zeroes (2014-05-19 13:42:27 +0200)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Fam Zheng (1):
qemu-iotests: Fix blkdebug in VM drive in 030
Jeff Cody (2):
block: vhdx - account for identical header sections
block: add test for vhdx image created by Disk2VHD
Kevin Wolf (6):
block: Fix bdrv_is_allocated() for short backing files
qcow1: Make padding in the header explicit
qcow1: Check maximum cluster size
qcow1: Validate L2 table size (CVE-2014-0222)
qcow1: Validate image size (CVE-2014-0223)
qcow1: Stricter backing file length check
Markus Armbruster (1):
qemu-iotests: Fix core dump suppression in test 039
Matthew Booth (4):
curl: Fix build when curl_multi_socket_action isn't available
curl: Remove broken parsing of options from url
curl: Add sslverify option
curl: Add usage documentation
Max Reitz (4):
qdict: Add qdict_join()
check-qdict: Add test for qdict_join()
block: Allow JSON filenames
iotests: Add test for the JSON protocol
Mike Day (1):
Remove g_sequence_lookup from qemu-img help function
Peter Lieven (3):
util: add qemu_iovec_is_zero
blockdev: add a function to parse enum ids from strings
block: optimize zero writes with bdrv_write_zeroes
block.c | 60 +++++++++- block/curl.c | 79 ++++++------- block/qapi.c | 1 + block/qcow.c | 44 +++++-- block/vhdx.c | 9 +- blockdev.c | 43 +++++++ hmp.c | 5 + include/block/block.h | 11 +- include/block/block_int.h | 1 + include/qapi/qmp/qdict.h | 3 + include/qemu-common.h | 1 + qapi-schema.json | 52 ++++++--- qemu-img.c | 7 +- qemu-options.hx | 74 ++++++++++++ qmp-commands.hx | 3 + qobject/qdict.c | 32 +++++ tests/check-qdict.c | 87 ++++++++++++++ tests/qemu-iotests/030 | 2 +- tests/qemu-iotests/039 | 20 ++-- tests/qemu-iotests/039.out | 3 + tests/qemu-iotests/067.out | 10 +- tests/qemu-iotests/070 | 7 ++ tests/qemu-iotests/070.out | 7 ++ tests/qemu-iotests/089 | 130 +++++++++++++++++++++ tests/qemu-iotests/089.out | 54 +++++++++ tests/qemu-iotests/092 | 98 ++++++++++++++++ tests/qemu-iotests/092.out | 38 ++++++ tests/qemu-iotests/common.filter | 1 + tests/qemu-iotests/group | 2 + .../sample_images/test-disk2vhd.vhdx.bz2 | Bin 0 -> 1424 bytes util/iov.c | 21 ++++ 31 files changed, 809 insertions(+), 96 deletions(-) create mode 100755 tests/qemu-iotests/089 create mode 100644 tests/qemu-iotests/089.out create mode 100755 tests/qemu-iotests/092 create mode 100644 tests/qemu-iotests/092.out create mode 100644 tests/qemu-iotests/sample_images/test-disk2vhd.vhdx.bz2
[Qemu-devel] [PULL 02/22] Remove g_sequence_lookup from qemu-img help function
From: Mike Day <[email protected]>
g_sequence_lookup is not supported by glib < 2.28. The usage of g_sequence_lookup is not essential in this context (it's a safeguard against duplicate values in the help message). Removing the call enables the build on all platforms and does not change the operation of the help function.
--- qemu-img.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
qemu-img.c +2 -5
@@ -70,11 +70,8 @@ static void add_format_to_seq(void *opaque, const char *fmt_name) {GSequence *seq = opaque; -if (!g_sequence_lookup (seq, (gpointer )fmt_name, - compare_data,NULL )) { -g_sequence_insert_sorted (seq, (gpointer )fmt_name, - compare_data,NULL ); - } +g_sequence_insert_sorted (seq, (gpointer )fmt_name, + compare_data,NULL ); } static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 05/22] qdict: Add qdict_join()
In reply to Kevin WolfFrom: Max Reitz <[email protected]>
This function joins two QDicts by absorbing one into the other.
--- include/qapi/qmp/qdict.h | 3 +++ qobject/qdict.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
include/qapi/qmp/qdict.h +3 -0
@@ -16,6 +16,7 @@#include "qapi/qmp/qobject.h" #include "qapi/qmp/qlist.h" #include "qemu/queue.h" +#include <stdbool.h> #include <stdint.h> #define QDICT_BUCKET_MAX 512
@@ -70,4 +71,6 @@ void qdict_flatten(QDict *qdict);void qdict_extract_subqdict (QDict *src,QDict **dst,const char *start);void qdict_array_split (QDict *src,QList **dst); +void qdict_join (QDict *dest,QDict *src,bool overwrite); +#endif /* QDICT_H */
qobject/qdict.c +32 -0
@@ -665,3 +665,35 @@ void qdict_array_split(QDict *src, QList **dst)qlist_append_obj (*dst, subqobj ?:QOBJECT (subqdict)); } } + +/** +* qdict_join(): Absorb the src QDict into the dest QDict, that is, move all +* elements from src to dest. +* +* If an element from src has a key already present in dest, it will not be +* moved unless overwrite is true. +* +* If overwrite is true, the conflicting values in dest will be discarded and +* replaced by the corresponding values from src. +* +* Therefore, with overwrite being true, the src QDict will always be empty when +* this function returns. If overwrite is false, the src QDict will be empty +* iff there were no conflicts. +*/ +void qdict_join (QDict *dest,QDict *src,bool overwrite) +{ +const QDictEntry *entry, *next; + + entry =qdict_first (src); +while (entry) { + next =qdict_next (src, entry); + +if (overwrite || !qdict_haskey (dest, entry->key)) { +qobject_incref (entry->value); +qdict_put_obj (dest, entry->key, entry->value); +qdict_del (src, entry->key); + } + + entry = next; + } +}
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 04/22] block: add test for vhdx image created by Disk2VHD
In reply to Kevin WolfFrom: Jeff Cody <[email protected]>
This adds a test for VHDX images created by Microsoft's tool, Disk2VHD.
VHDX images created by this tool have 2 identical header sections, with identical sequence numbers. This makes sure we detect VHDX images with identical headers, and do not flag them as corrupt.
--- tests/qemu-iotests/070 | 7 +++++++ tests/qemu-iotests/070.out | 7 +++++++ tests/qemu-iotests/sample_images/test-disk2vhd.vhdx.bz2 | Bin 0 -> 1424 bytes 3 files changed, 14 insertions(+) create mode 100644 tests/qemu-iotests/sample_images/test-disk2vhd.vhdx.bz2
tests/qemu-iotests/070 +7 -0
@@ -72,6 +72,13 @@ echo "=== Verify open image read-only succeeds after log replay ===" $QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | _filter_testdir \ | _filter_qemu_io +_cleanup_test_img +_use_sample_img test-disk2vhd.vhdx.bz2 + +echo +echo "=== Verify image created by Disk2VHD can be opened ===" +$QEMU_IMG info "$TEST_IMG" 2>&1 | _filter_testdir | _filter_qemu + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/070.out +7 -0
@@ -18,4 +18,11 @@ No errors were found on the image. === Verify open image read-only succeeds after log replay === read 18874368/18874368 bytes at offset 0 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=== Verify image created by Disk2VHD can be opened === +image: TEST_DIR/test-disk2vhd.vhdx +file format: vhdx +virtual size: 256M (268435456 bytes) +disk size: 260M +cluster_size: 2097152 *** done
tests/qemu-iotests/sample_images/test-disk2vhd.vhdx.bz2 new file binary +0 -0
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 06/22] check-qdict: Add test for qdict_join()
In reply to Kevin WolfFrom: Max Reitz <[email protected]>
Add some test cases for qdict_join().
--- tests/check-qdict.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+)
tests/check-qdict.c +87 -0
@@ -444,6 +444,92 @@ static void qdict_array_split_test(void)QDECREF (test_dict); } +static void qdict_join_test (void ) +{ +QDict *dict1, *dict2; +bool overwrite = false; +int i; + + dict1 =qdict_new (); + dict2 =qdict_new (); + + +/* Test everything once without overwrite and once with */ +do + { +/* Test empty dicts */ +qdict_join (dict1, dict2, overwrite); + +g_assert (qdict_size (dict1) ==0 ); +g_assert (qdict_size (dict2) ==0 ); + + +/* First iteration: Test movement */ +/* Second iteration: Test empty source and non-empty destination */ +qdict_put (dict2,"foo" ,qint_from_int (42 )); + +for (i =0 ; i <2 ; i++) { +qdict_join (dict1, dict2, overwrite); + +g_assert (qdict_size (dict1) ==1 ); +g_assert (qdict_size (dict2) ==0 ); + +g_assert (qdict_get_int (dict1,"foo" ) ==42 ); + } + + +/* Test non-empty source and destination without conflict */ +qdict_put (dict2,"bar" ,qint_from_int (23 )); + +qdict_join (dict1, dict2, overwrite); + +g_assert (qdict_size (dict1) ==2 ); +g_assert (qdict_size (dict2) ==0 ); + +g_assert (qdict_get_int (dict1,"foo" ) ==42 ); +g_assert (qdict_get_int (dict1,"bar" ) ==23 ); + + +/* Test conflict */ +qdict_put (dict2,"foo" ,qint_from_int (84 )); + +qdict_join (dict1, dict2, overwrite); + +g_assert (qdict_size (dict1) ==2 ); +g_assert (qdict_size (dict2) == !overwrite); + +g_assert (qdict_get_int (dict1,"foo" ) == overwrite ?84 :42 ); +g_assert (qdict_get_int (dict1,"bar" ) ==23 ); + +if (!overwrite) { +g_assert (qdict_get_int (dict2,"foo" ) ==84 ); + } + + +/* Check the references */ +g_assert (qdict_get (dict1,"foo" )->refcnt ==1 ); +g_assert (qdict_get (dict1,"bar" )->refcnt ==1 ); + +if (!overwrite) { +g_assert (qdict_get (dict2,"foo" )->refcnt ==1 ); + } + + +/* Clean up */ +qdict_del (dict1,"foo" ); +qdict_del (dict1,"bar" ); + +if (!overwrite) { +qdict_del (dict2,"foo" ); + } + } +while (overwrite ^= true); + + +QDECREF (dict1); +QDECREF (dict2); +} +/* * Errors test-cases */
@@ -584,6 +670,7 @@ int main(int argc, char **argv)g_test_add_func ("/public/iterapi" , qdict_iterapi_test);g_test_add_func ("/public/flatten" , qdict_flatten_test);g_test_add_func ("/public/array_split" , qdict_array_split_test); +g_test_add_func ("/public/join" , qdict_join_test);g_test_add_func ("/errors/put_exists" , qdict_put_exists_test);g_test_add_func ("/errors/get_not_exists" , qdict_get_not_exists_test);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 01/22] block: Fix bdrv_is_allocated() for short backing files
In reply to Kevin Wolfbdrv_is_allocated() shouldn't return true for sectors that are unallocated, but after the end of a short backing file, even though such sectors are (correctly) marked as containing zeros.
--- block.c | 10 ++++++---- include/block/block.h | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
block.c +6 -4
@@ -3864,7 +3864,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,if (!bs->drv->bdrv_co_get_block_status) { *pnum = nb_sectors; - ret =BDRV_BLOCK_DATA ; + ret =BDRV_BLOCK_DATA |BDRV_BLOCK_ALLOCATED ;if (bs->drv->protocol_name) { ret |=BDRV_BLOCK_OFFSET_VALID | (sector_num *BDRV_SECTOR_SIZE ); }
@@ -3883,6 +3883,10 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, *pnum, pnum); } +if (ret & (BDRV_BLOCK_DATA |BDRV_BLOCK_ZERO )) { + ret |=BDRV_BLOCK_ALLOCATED ; + } +if (!(ret &BDRV_BLOCK_DATA ) && !(ret &BDRV_BLOCK_ZERO )) {if (bdrv_unallocated_blocks_are_zero (bs)) { ret |=BDRV_BLOCK_ZERO ;
@@ -3959,9 +3963,7 @@ int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,if (ret <0 ) {return ret; } -return - (ret &BDRV_BLOCK_DATA ) || - ((ret &BDRV_BLOCK_ZERO ) && !bdrv_has_zero_init (bs)); +return (ret &BDRV_BLOCK_ALLOCATED ); }/*
include/block/block.h +7 -4
@@ -120,6 +120,8 @@ typedef enum {/* BDRV_BLOCK_DATA: data is read from bs->file or another file * BDRV_BLOCK_ZERO: sectors read as zero * BDRV_BLOCK_OFFSET_VALID: sector stored in bs->file as raw data +* BDRV_BLOCK_ALLOCATED: the content of the block is determined by this +* layer (as opposed to the backing file) * BDRV_BLOCK_RAW: used internally to indicate that the request * was answered by the raw driver and that one * should look in bs->file directly.
@@ -141,10 +143,11 @@ typedef enum {* f t f not allocated or unknown offset, read as zero * f f f not allocated or unknown offset, read from backing_hd */ -#define BDRV_BLOCK_DATA 1 -#define BDRV_BLOCK_ZERO 2 -#define BDRV_BLOCK_OFFSET_VALID 4 -#define BDRV_BLOCK_RAW 8 +#define BDRV_BLOCK_DATA 0x01 +#define BDRV_BLOCK_ZERO 0x02 +#define BDRV_BLOCK_OFFSET_VALID 0x04 +#define BDRV_BLOCK_RAW 0x08 +#define BDRV_BLOCK_ALLOCATED 0x10#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK typedef enum {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 03/22] block: vhdx - account for identical header sections
In reply to Kevin WolfFrom: Jeff Cody <[email protected]>
The VHDX spec v1.00 declares that "a header is current if it is the only valid header or if it is valid and its SequenceNumber field is greater than the other header’s SequenceNumber field. The parser must only use data from the current header. If there is no current header, then the VHDX file is corrupt."
However, the Disk2VHD tool from Microsoft creates a VHDX image file that has 2 identical headers, including matching checksums and matching sequence numbers. Likely, as a shortcut the tool is just writing the header twice, for the active and inactive headers, during the image creation. Technically, this should be considered a corrupt VHDX file (at least per the 1.00 spec, and that is how we currently treat it).
But in order to accomodate images created with Disk2VHD, we can safely create an exception for this case. If we find identical sequence numbers, then we check the VHDXHeader-sized chunks of each 64KB header sections (we won't rely just on the crc32c to indicate the headers are the same). If they are identical, then we go ahead and use the first one.
--- block/vhdx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
block/vhdx.c +8 -1
@@ -473,7 +473,14 @@ static void vhdx_parse_header(BlockDriverState *bs, BDRVVHDXState *s, }else if (h2_seq > h1_seq) { s->curr_header =1 ; }else { - goto fail; +/* The Microsoft Disk2VHD tool will create 2 identical +* headers, with identical sequence numbers. If the headers are +* identical, don't consider the file corrupt */ +if (!memcmp (header1, header2,sizeof (VHDXHeader))) { + s->curr_header =0 ; + }else { + goto fail; + } } }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 08/22] iotests: Add test for the JSON protocol
In reply to Kevin WolfFrom: Max Reitz <[email protected]>
Add a test for the JSON protocol driver.
--- tests/qemu-iotests/089 | 130 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/089.out | 54 +++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 185 insertions(+) create mode 100755 tests/qemu-iotests/089 create mode 100644 tests/qemu-iotests/089.out
tests/qemu-iotests/089 new file +130 -0
@@ -0,0 +1,130 @@ +#!/bin/bash +# +# Test case for support of JSON filenames +# +# Copyright (C) 2014 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 [email protected] + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +# Using an image filename containing quotation marks will render the JSON data +# below invalid. In that case, we have little choice but simply not to run this +# test. +case $TEST_IMG in + *'"'*) + _notrun "image filename may not contain quotation marks" + ;; +esac + +IMG_SIZE=64M + +# Taken from test 072 +echo +echo "=== Testing nested image formats ===" +echo + +TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE + +$QEMU_IO -c 'write -P 42 0 512' -c 'write -P 23 512 512' \ + -c 'write -P 66 1024 512' "$TEST_IMG.base" | _filter_qemu_io + +$QEMU_IMG convert -f raw -O $IMGFMT "$TEST_IMG.base" "$TEST_IMG" + +$QEMU_IO -c 'read -P 42 0 512' -c 'read -P 23 512 512' \ + -c 'read -P 66 1024 512' "json:{ + \"driver\": \"$IMGFMT\", + \"file\": { + \"driver\": \"$IMGFMT\", + \"file\": { + \"filename\": \"$TEST_IMG\" + } + } +}" | _filter_qemu_io + +# This should fail (see test 072) +$QEMU_IO -c 'read -P 42 0 512' "$TEST_IMG" | _filter_qemu_io + + +# Taken from test 071 +echo +echo "=== Testing blkdebug ===" +echo + +_make_test_img $IMG_SIZE + +$QEMU_IO -c 'write -P 42 0x38000 512' "$TEST_IMG" | _filter_qemu_io + +# The "image.filename" part tests whether "a": { "b": "c" } and "a.b": "c" do +# the same (which they should). +$QEMU_IO -c 'read -P 42 0x38000 512' "json:{ + \"driver\": \"$IMGFMT\", + \"file\": { + \"driver\": \"blkdebug\", + \"inject-error\": [{ + \"event\": \"l2_load\" + }], + \"image.filename\": \"$TEST_IMG\" + } +}" | _filter_qemu_io + + +echo +echo "=== Testing qemu-img info output ===" +echo + +$QEMU_IMG info "json:{\"driver\":\"qcow2\",\"file.filename\":\"$TEST_IMG\"}" \ + | _filter_testdir | _filter_imgfmt + + +echo +echo "=== Testing option merging ===" +echo + +# Both options given directly and those given in the filename should be used +$QEMU_IO -c "open -o driver=qcow2 json:{\"file.filename\":\"$TEST_IMG\"}" \ + -c "info" 2>&1 | _filter_testdir | _filter_imgfmt + +# Options given directly should be prioritized over those given in the filename +$QEMU_IO -c "open -o driver=qcow2 json:{\"driver\":\"raw\",\"file.filename\":\"$TEST_IMG\"}" \ + -c "info" 2>&1 | _filter_testdir | _filter_imgfmt + + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
tests/qemu-iotests/089.out new file +54 -0
54 lines not on this page · raw message
tests/qemu-iotests/group +1 -0
@@ -95,5 +95,6 @@ 086 rw auto quick 087 rw auto 088 rw auto +089 rw auto quick 090 rw auto quick 091 rw auto
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 09/22] qemu-iotests: Fix core dump suppression in test 039
In reply to Kevin WolfFrom: Markus Armbruster <[email protected]>
The shell script attempts to suppress core dumps like this:
old_ulimit=$(ulimit -c)
ulimit -c 0
$QEMU_IO arg...
ulimit -c "$old_ulimit"
This breaks the test hard unless the limit was zero to begin with! ulimit sets both hard and soft limit by default, and (re-)raising the hard limit requires privileges. Broken since it was added in commit dc68afe.
Could be fixed by adding -S to set only the soft limit, but I'm not sure how portable that is in practice. Simply do it in a subshell instead, like this:
(ulimit -c 0; exec $QEMU_IO arg...)
--- tests/qemu-iotests/039 | 20 ++++++++------------ tests/qemu-iotests/039.out | 3 +++ tests/qemu-iotests/common.filter | 1 + 3 files changed, 12 insertions(+), 12 deletions(-)
tests/qemu-iotests/039 +8 -12
@@ -47,6 +47,11 @@ _supported_os Linux _default_cache_mode "writethrough" _supported_cache_modes "writethrough" +_no_dump_exec() +{ + (ulimit -c 0; exec "$@") +} + size=128M echo
@@ -67,10 +72,7 @@ echo "== Creating a dirty image file ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size -old_ulimit=$(ulimit -c) -ulimit -c 0 # do not produce a core dump on abort(3) -$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io -ulimit -c "$old_ulimit" +_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io # The dirty bit must be set ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
@@ -103,10 +105,7 @@ echo "== Opening a dirty image read/write should repair it ==" IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img $size -old_ulimit=$(ulimit -c) -ulimit -c 0 # do not produce a core dump on abort(3) -$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io -ulimit -c "$old_ulimit" +_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io # The dirty bit must be set ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
@@ -122,10 +121,7 @@ echo "== Creating an image file with lazy_refcounts=off ==" IMGOPTS="compat=1.1,lazy_refcounts=off" _make_test_img $size -old_ulimit=$(ulimit -c) -ulimit -c 0 # do not produce a core dump on abort(3) -$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" | _filter_qemu_io -ulimit -c "$old_ulimit" +_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io # The dirty bit must not be set since lazy_refcounts=off ./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
tests/qemu-iotests/039.out +3 -0
@@ -11,6 +11,7 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +./039: Aborted ( ulimit -c 0; exec "$@" ) incompatible_features 0x1 ERROR cluster 5 refcount=0 reference=1 ERROR OFLAG_COPIED data cluster: l2_entry=8000000000050000 refcount=0
@@ -42,6 +43,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +./039: Aborted ( ulimit -c 0; exec "$@" ) incompatible_features 0x1 Repairing cluster 5 refcount=0 reference=1 wrote 512/512 bytes at offset 0
@@ -52,6 +54,7 @@ incompatible_features 0x0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +./039: Aborted ( ulimit -c 0; exec "$@" ) incompatible_features 0x0 No errors were found on the image.
tests/qemu-iotests/common.filter +1 -0
@@ -150,6 +150,7 @@ _filter_win32() _filter_qemu_io() { _filter_win32 | sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/" \ + -e "s/: line [0-9][0-9]*: *[0-9][0-9]*\( Aborted\)/:\1/" \ -e "s/qemu-io> //g" }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 07/22] block: Allow JSON filenames
In reply to Kevin WolfFrom: Max Reitz <[email protected]>
If the filename given to bdrv_open() is prefixed with "json:", parse the rest as a JSON object and merge the result into the options QDict. If there are conflicts, the options QDict takes precedence.
--- block.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
block.c +41 -0
@@ -1274,6 +1274,33 @@ out:g_free (tmp_filename); } +static QDict *parse_json_filename (const char *filename,Error **errp) +{ +QObject *options_obj; +QDict *options; +int ret; + + ret =strstart (filename,"json:" , &filename); +assert (ret); + + options_obj =qobject_from_json (filename); +if (!options_obj) { +error_setg (errp,"Could not parse the JSON options" ); +return NULL ; + } + +if (qobject_type (options_obj) !=QTYPE_QDICT ) { +qobject_decref (options_obj); +error_setg (errp,"Invalid JSON object given" ); +return NULL ; + } + + options =qobject_to_qdict (options_obj); +qdict_flatten (options); + +return options; +} +/* * Opens a disk image (raw, qcow2, vmdk, ...) *
@@ -1337,6 +1364,20 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, options =qdict_new (); } +if (filename &&g_str_has_prefix (filename,"json:" )) { +QDict *json_options =parse_json_filename (filename, &local_err); +if (local_err) { + ret = -EINVAL ; + goto fail; + } + +/* Options given in the filename have lower priority than options +* specified directly */ +qdict_join (options, json_options, false); +QDECREF (json_options); + filename =NULL ; + } + bs->options = options; options =qdict_clone_shallow (options);
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 10/22] qemu-iotests: Fix blkdebug in VM drive in 030
In reply to Kevin WolfFrom: Fam Zheng <[email protected]>
The test test_stream_pause in this class uses vm.pause_drive, which requires a blkdebug driver on top of image, otherwise it's no-op and the test running is undeterministic.
So add it.
--- tests/qemu-iotests/030 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/030 +1 -1
@@ -35,7 +35,7 @@ class TestSingleDrive(iotests.QMPTestCase): qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % backing_img, mid_img) qemu_img('create', '-f', iotests.imgfmt, '-o', 'backing_file=%s' % mid_img, test_img) qemu_io('-c', 'write -P 0x1 0 512', backing_img) - self.vm = iotests.VM().add_drive(test_img) + self.vm = iotests.VM().add_drive("blkdebug::" + test_img) self.vm.launch() def tearDown(self):
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 14/22] curl: Add usage documentation
In reply to Kevin WolfFrom: Matthew Booth <[email protected]>
--- qemu-options.hx | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
qemu-options.hx +68 -0
@@ -2191,6 +2191,74 @@ qemu-system-x86_64 --drive file=gluster://192.0.2.1/testvol/a.img @end example See also @url{http://www.gluster.org}. + +@item HTTP/HTTPS/FTP/FTPS/TFTP +QEMU supports read-only access to files accessed over http(s), ftp(s) and tftp. + +Syntax using a single filename: +@example +<protocol>://[<username>[:<password>]@@]<host>/<path> +@end example + +where: +@table @option +@item protocol +'http', 'https', 'ftp', 'ftps', or 'tftp'. + +@item username +Optional username for authentication to the remote server. + +@item password +Optional password for authentication to the remote server. + +@item host +Address of the remote server. + +@item path +Path on the remote server, including any query string. +@end table + +The following options are also supported: +@table @option +@item url +The full URL when passing options to the driver explicitly. + +@item readahead +The amount of data to read ahead with each range request to the remote server. +This value may optionally have the suffix 'T', 'G', 'M', 'K', 'k' or 'b'. If it +does not have a suffix, it will be assumed to be in bytes. The value must be a +multiple of 512 bytes. It defaults to 256k. + +@item sslverify +Whether to verify the remote server's certificate when connecting over SSL. It +can have the value 'on' or 'off'. It defaults to 'on'. +@end table + +Note that when passing options to qemu explicitly, @option{driver} is the value +of <protocol>. + +Example: boot from a remote Fedora 20 live ISO image +@example +qemu-system-x86_64 --drive media=cdrom,file=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly + +qemu-system-x86_64 --drive media=cdrom,file.driver=http,file.url=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Live/x86_64/Fedora-Live-Desktop-x86_64-20-1.iso,readonly +@end example + +Example: boot from a remote Fedora 20 cloud image using a local overlay for +writes, copy-on-read, and a readahead of 64k +@example +qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"http",, "file.url":"https://dl.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2",, "file.readahead":"64k"@}' /tmp/Fedora-x86_64-20-20131211.1-sda.qcow2 + +qemu-system-x86_64 -drive file=/tmp/Fedora-x86_64-20-20131211.1-sda.qcow2,copy-on-read=on +@end example + +Example: boot from an image stored on a VMware vSphere server with a self-signed +certificate using a local overlay for writes and a readahead of 64k +@example +qemu-img create -f qcow2 -o backing_file='json:@{"file.driver":"https",, "file.url":"https://user:password@@vsphere.example.com/folder/test/test-flat.vmdk?dcPath=Datacenter&dsName=datastore1",, "file.sslverify":"off",, "file.readahead":"64k"@}' /tmp/test.qcow2 + +qemu-system-x86_64 -drive file=/tmp/test.qcow2 +@end example ETEXI STEXI
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 11/22] curl: Fix build when curl_multi_socket_action isn't available
In reply to Kevin WolfFrom: Matthew Booth <[email protected]>
--- block/curl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
block/curl.c +15 -0
@@ -37,6 +37,21 @@#if LIBCURL_VERSION_NUM >=0x071000 /* The multi interface timer callback was introduced in 7.16.0 */ #define NEED_CURL_TIMER_CALLBACK +#define HAVE_SOCKET_ACTION +#endif + +#ifndef HAVE_SOCKET_ACTION +/* If curl_multi_socket_action isn't available, define it statically here in +* terms of curl_multi_socket. Note that ev_bitmask will be ignored, which is +* less efficient but still safe. */ +static CURLMcode __curl_multi_socket_action (CURLM *multi_handle, +curl_socket_t sockfd, +int ev_bitmask, +int *running_handles) +{ +return curl_multi_socket (multi_handle, sockfd, running_handles); +} +#define curl_multi_socket_action __curl_multi_socket_action#endif #define PROTOCOLS (CURLPROTO_HTTP | CURLPROTO_HTTPS | \
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 12/22] curl: Remove broken parsing of options from url
In reply to Kevin WolfFrom: Matthew Booth <[email protected]>
The block layer now supports a generic json syntax for passing option parameters explicitly, making parsing of options from the url redundant.
--- block/curl.c | 52 ++++++++++------------------------------------------ 1 file changed, 10 insertions(+), 42 deletions(-)
block/curl.c +10 -42
@@ -61,12 +61,15 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,#define CURL_NUM_STATES 8#define CURL_NUM_ACB 8#define SECTOR_SIZE 512 -#define READ_AHEAD_SIZE (256 * 1024) +#define READ_AHEAD_DEFAULT (256 * 1024)#define FIND_RET_NONE 0#define FIND_RET_OK 1#define FIND_RET_WAIT 2 +#define CURL_BLOCK_OPT_URL "url" +#define CURL_BLOCK_OPT_READAHEAD "readahead" +struct BDRVCURLState ; typedef struct CURLAIOCB {
@@ -411,43 +414,7 @@ static void curl_clean_state(CURLState *s)static void curl_parse_filename (const char *filename,QDict *options,Error **errp) { - -#define RA_OPTSTR ":readahead=" -char *file; -char *ra; -const char *ra_val; -int parse_state =0 ; - - file =g_strdup (filename); - -/* Parse a trailing ":readahead=#:" param, if present. */ - ra = file +strlen (file) -1 ; -while (ra >= file) { -if (parse_state ==0 ) { -if (*ra ==':' ) { - parse_state++; - }else { -break ; - } - }else if (parse_state ==1 ) { -if (*ra >'9' || *ra <'0' ) { -char *opt_start = ra -strlen (RA_OPTSTR ) +1 ; -if (opt_start > file && -strncmp (opt_start,RA_OPTSTR ,strlen (RA_OPTSTR )) ==0 ) { - ra_val = ra +1 ; - ra -=strlen (RA_OPTSTR ) -1 ; - *ra ='\0' ; -qdict_put (options,"readahead" ,qstring_from_str (ra_val)); - } -break ; - } - } - ra--; - } - -qdict_put (options,"url" ,qstring_from_str (file)); - -g_free (file); +qdict_put (options,CURL_BLOCK_OPT_URL ,qstring_from_str (filename)); }static QemuOptsList runtime_opts = {
@@ -455,12 +422,12 @@ static QemuOptsList runtime_opts = { .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head), .desc = { { - .name = "url", + .name = CURL_BLOCK_OPT_URL, .type = QEMU_OPT_STRING, .help = "URL to open", }, { - .name = "readahead", + .name = CURL_BLOCK_OPT_READAHEAD, .type = QEMU_OPT_SIZE, .help = "Readahead size", },
@@ -492,14 +459,15 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, goto out_noclean; } - s->readahead_size =qemu_opt_get_size (opts,"readahead" ,READ_AHEAD_SIZE ); + s->readahead_size =qemu_opt_get_size (opts,CURL_BLOCK_OPT_READAHEAD , +READ_AHEAD_DEFAULT );if ((s->readahead_size &0x1ff ) !=0 ) {error_setg (errp,"HTTP_READAHEAD_SIZE %zd is not a multiple of 512" , s->readahead_size); goto out_noclean; } - file =qemu_opt_get (opts,"url" ); + file =qemu_opt_get (opts,CURL_BLOCK_OPT_URL );if (file ==NULL ) {error_setg (errp,"curl block driver requires an 'url' option" ); goto out_noclean;
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 15/22] qcow1: Make padding in the header explicit
In reply to Kevin WolfWe were relying on all compilers inserting the same padding in the header struct that is used for the on-disk format. Let's not do that. Mark the struct as packed and insert an explicit padding field for compatibility.
--- block/qcow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/qcow.c +2 -1
@@ -48,9 +48,10 @@ typedef struct QCowHeader {uint64_t size;/* in bytes */ uint8_t cluster_bits;uint8_t l2_bits; +uint16_t padding;uint32_t crypt_method;uint64_t l1_table_offset; -} QCowHeader; +}QEMU_PACKED QCowHeader;#define L2_CACHE_SIZE 16
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 16/22] qcow1: Check maximum cluster size
In reply to Kevin WolfHuge values for header.cluster_bits cause unbounded allocations (e.g. for s->cluster_cache) and crash qemu this way. Less huge values may survive those allocations, but can cause integer overflows later on.
The only cluster sizes that qemu can create are 4k (for standalone images) and 512 (for images with backing files), so we can limit it to 64k.
--- block/qcow.c | 10 ++++++-- tests/qemu-iotests/092 | 63 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/092.out | 13 ++++++++++ tests/qemu-iotests/group | 1 + 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100755 tests/qemu-iotests/092 create mode 100644 tests/qemu-iotests/092.out
block/qcow.c +8 -2
@@ -128,11 +128,17 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } -if (header.size <=1 || header.cluster_bits <9 ) { -error_setg (errp,"invalid value in qcow header" ); +if (header.size <=1 ) { +error_setg (errp,"Image size is too small (must be at least 2 bytes)" ); ret = -EINVAL ; goto fail; } +if (header.cluster_bits <9 || header.cluster_bits >16 ) { +error_setg (errp,"Cluster size must be between 512 and 64k" ); + ret = -EINVAL ; + goto fail; + } +if (header.crypt_method >QCOW_CRYPT_AES ) {error_setg (errp,"invalid encryption method in qcow header" ); ret = -EINVAL ;
tests/qemu-iotests/092 new file +63 -0
63 lines not on this page · raw message
tests/qemu-iotests/092.out new file +13 -0
@@ -0,0 +1,13 @@ +QA output created by 092 + +== Invalid cluster size == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +no file open, try 'help open' +*** done
tests/qemu-iotests/group +1 -0
@@ -98,3 +98,4 @@ 089 rw auto quick 090 rw auto quick 091 rw auto +092 rw auto quick
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 13/22] curl: Add sslverify option
In reply to Kevin WolfFrom: Matthew Booth <[email protected]>
This allows qemu to use images over https with a self-signed certificate. It defaults to verifying the certificate.
--- block/curl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
block/curl.c +12 -0
@@ -23,6 +23,7 @@*/ #include "qemu-common.h" #include "block/block_int.h" +#include "qapi/qmp/qbool.h" #include <curl/curl.h> // #define DEBUG
@@ -69,6 +70,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,#define CURL_BLOCK_OPT_URL "url"#define CURL_BLOCK_OPT_READAHEAD "readahead" +#define CURL_BLOCK_OPT_SSLVERIFY "sslverify"struct BDRVCURLState ;
@@ -106,6 +108,7 @@ typedef struct BDRVCURLState {CURLState states[CURL_NUM_STATES ];char *url;size_t readahead_size; +bool sslverify;bool accept_range; } BDRVCURLState;
@@ -372,6 +375,8 @@ static CURLState *curl_init_state(BDRVCURLState *s)return NULL ; }curl_easy_setopt (state->curl,CURLOPT_URL , s->url); +curl_easy_setopt (state->curl,CURLOPT_SSL_VERIFYPEER , + (long ) s->sslverify);curl_easy_setopt (state->curl,CURLOPT_TIMEOUT ,5 );curl_easy_setopt (state->curl,CURLOPT_WRITEFUNCTION , (void *)curl_read_cb);
@@ -431,6 +436,11 @@ static QemuOptsList runtime_opts = { .type = QEMU_OPT_SIZE, .help = "Readahead size", }, + { + .name = CURL_BLOCK_OPT_SSLVERIFY, + .type = QEMU_OPT_BOOL, + .help = "Verify SSL certificate" + }, {/* end of list */ } }, };
@@ -467,6 +477,8 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, goto out_noclean; } + s->sslverify =qemu_opt_get_bool (opts,CURL_BLOCK_OPT_SSLVERIFY , true); + file =qemu_opt_get (opts,CURL_BLOCK_OPT_URL );if (file ==NULL ) {error_setg (errp,"curl block driver requires an 'url' option" );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 17/22] qcow1: Validate L2 table size (CVE-2014-0222)
In reply to Kevin WolfToo large L2 table sizes cause unbounded allocations. Images actually created by qemu-img only have 512 byte or 4k L2 tables.
To keep things consistent with cluster sizes, allow ranges between 512 bytes and 64k (in fact, down to 1 entry = 8 bytes is technically working, but L2 table sizes smaller than a cluster don't make a lot of sense).
This also means that the number of bytes on the virtual disk that are described by the same L2 table is limited to at most 8k * 64k or 2^29, preventively avoiding any integer overflows.
--- block/qcow.c | 8 ++++++++ tests/qemu-iotests/092 | 15 +++++++++++++++ tests/qemu-iotests/092.out | 11 +++++++++++ 3 files changed, 34 insertions(+)
block/qcow.c +8 -0
@@ -139,6 +139,14 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } +/* l2_bits specifies number of entries; storing a uint64_t in each entry, +* so bytes = num_entries << 3. */ +if (header.l2_bits <9 -3 || header.l2_bits >16 -3 ) { +error_setg (errp,"L2 table size must be between 512 and 64k" ); + ret = -EINVAL ; + goto fail; + } +if (header.crypt_method >QCOW_CRYPT_AES ) {error_setg (errp,"invalid encryption method in qcow header" ); ret = -EINVAL ;
tests/qemu-iotests/092 +15 -0
@@ -44,6 +44,7 @@ _supported_proto generic _supported_os Linux offset_cluster_bits=32 +offset_l2_bits=33 echo echo "== Invalid cluster size =="
@@ -57,6 +58,20 @@ poke_file "$TEST_IMG" "$offset_cluster_bits" "\x08" poke_file "$TEST_IMG" "$offset_cluster_bits" "\x11" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo +echo "== Invalid L2 table size ==" +_make_test_img 64M +poke_file "$TEST_IMG" "$offset_l2_bits" "\xff" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +poke_file "$TEST_IMG" "$offset_l2_bits" "\x05" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +poke_file "$TEST_IMG" "$offset_l2_bits" "\x0e" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir + +# 1 << 0x1b = 2^31 / L2_CACHE_SIZE +poke_file "$TEST_IMG" "$offset_l2_bits" "\x1b" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/092.out +11 -0
@@ -10,4 +10,15 @@ qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and no file open, try 'help open' qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k no file open, try 'help open' + +== Invalid L2 table size == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 19/22] qcow1: Stricter backing file length check
In reply to Kevin WolfLike qcow2 since commit 6d33e8e7, error out on invalid lengths instead of silently truncating them to 1023.
Also don't rely on bdrv_pread() catching integer overflows that make len negative, but use unsigned variables in the first place.
--- block/qcow.c | 7 +++++-- tests/qemu-iotests/092 | 11 +++++++++++ tests/qemu-iotests/092.out | 7 +++++++ 3 files changed, 23 insertions(+), 2 deletions(-)
block/qcow.c +5 -2
@@ -97,7 +97,8 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) {BDRVQcowState *s = bs->opaque; -int len, i, shift, ret; +unsigned int len, i, shift; +int ret;QCowHeader header; ret =bdrv_pread (bs->file,0 , &header,sizeof (header));
@@ -202,7 +203,9 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,if (header.backing_file_offset !=0 ) { len = header.backing_file_size;if (len >1023 ) { - len =1023 ; +error_setg (errp,"Backing file name too long" ); + ret = -EINVAL ; + goto fail; } ret =bdrv_pread (bs->file, header.backing_file_offset, bs->backing_file, len);
tests/qemu-iotests/092 +11 -0
@@ -43,6 +43,8 @@ _supported_fmt qcow _supported_proto generic _supported_os Linux +offset_backing_file_offset=8 +offset_backing_file_size=16 offset_size=24 offset_cluster_bits=32 offset_l2_bits=33
@@ -81,6 +83,15 @@ poke_file "$TEST_IMG" "$offset_size" "\xee\xee\xee\xee\xee\xee\xee\xee" poke_file "$TEST_IMG" "$offset_size" "\x7f\xff\xff\xff\xff\xff\xff\xff" { $QEMU_IO -c "write 0 64M" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo +echo "== Invalid backing file length ==" +_make_test_img 64M +poke_file "$TEST_IMG" "$offset_backing_file_offset" "\x00\x00\x00\xff" +poke_file "$TEST_IMG" "$offset_backing_file_size" "\xff\xff\xff\xff" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +poke_file "$TEST_IMG" "$offset_backing_file_size" "\x7f\xff\xff\xff" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/092.out +7 -0
@@ -28,4 +28,11 @@ qemu-io: can't open device TEST_DIR/t.qcow: Image too large no file open, try 'help open' qemu-io: can't open device TEST_DIR/t.qcow: Image too large no file open, try 'help open' + +== Invalid backing file length == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +qemu-io: can't open device TEST_DIR/t.qcow: Backing file name too long +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: Backing file name too long +no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 18/22] qcow1: Validate image size (CVE-2014-0223)
In reply to Kevin WolfA huge image size could cause s->l1_size to overflow. Make sure that images never require a L1 table larger than what fits in s->l1_size.
This cannot only cause unbounded allocations, but also the allocation of a too small L1 table, resulting in out-of-bounds array accesses (both reads and writes).
--- block/qcow.c | 16 ++++++++++++++-- tests/qemu-iotests/092 | 9 +++++++++ tests/qemu-iotests/092.out | 7 +++++++ 3 files changed, 30 insertions(+), 2 deletions(-)
block/qcow.c +14 -2
@@ -61,7 +61,7 @@ typedef struct BDRVQcowState {int cluster_sectors;int l2_bits;int l2_size; -int l1_size; +unsigned int l1_size;uint64_t cluster_offset_mask;uint64_t l1_table_offset;uint64_t *l1_table;
@@ -166,7 +166,19 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,/* read the level 1 table */ shift = s->cluster_bits + s->l2_bits; - s->l1_size = (header.size + (1LL << shift) -1 ) >> shift; +if (header.size >UINT64_MAX - (1LL << shift)) { +error_setg (errp,"Image too large" ); + ret = -EINVAL ; + goto fail; + }else { +uint64_t l1_size = (header.size + (1LL << shift) -1 ) >> shift; +if (l1_size >INT_MAX /sizeof (uint64_t )) { +error_setg (errp,"Image too large" ); + ret = -EINVAL ; + goto fail; + } + s->l1_size = l1_size; + } s->l1_table_offset = header.l1_table_offset; s->l1_table =g_malloc (s->l1_size *sizeof (uint64_t ));
tests/qemu-iotests/092 +9 -0
@@ -43,6 +43,7 @@ _supported_fmt qcow _supported_proto generic _supported_os Linux +offset_size=24 offset_cluster_bits=32 offset_l2_bits=33
@@ -72,6 +73,14 @@ poke_file "$TEST_IMG" "$offset_l2_bits" "\x0e" poke_file "$TEST_IMG" "$offset_l2_bits" "\x1b" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo +echo "== Invalid size ==" +_make_test_img 64M +poke_file "$TEST_IMG" "$offset_size" "\xee\xee\xee\xee\xee\xee\xee\xee" +{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +poke_file "$TEST_IMG" "$offset_size" "\x7f\xff\xff\xff\xff\xff\xff\xff" +{ $QEMU_IO -c "write 0 64M" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/092.out +7 -0
@@ -21,4 +21,11 @@ qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 an no file open, try 'help open' qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k no file open, try 'help open' + +== Invalid size == +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +qemu-io: can't open device TEST_DIR/t.qcow: Image too large +no file open, try 'help open' +qemu-io: can't open device TEST_DIR/t.qcow: Image too large +no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 20/22] util: add qemu_iovec_is_zero
In reply to Kevin WolfFrom: Peter Lieven <[email protected]>
--- include/qemu-common.h | 1 + util/iov.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+)
include/qemu-common.h +1 -0
@@ -318,6 +318,7 @@ void qemu_iovec_concat(QEMUIOVector *dst,void qemu_iovec_concat_iov (QEMUIOVector *dst,struct iovec *src_iov,unsigned int src_cnt,size_t soffset,size_t sbytes); +bool qemu_iovec_is_zero (QEMUIOVector *qiov);void qemu_iovec_destroy (QEMUIOVector *qiov);void qemu_iovec_reset (QEMUIOVector *qiov); size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset,
util/iov.c +21 -0
@@ -335,6 +335,27 @@ void qemu_iovec_concat(QEMUIOVector *dst,qemu_iovec_concat_iov (dst, src->iov, src->niov, soffset, sbytes); } +/* +* Check if the contents of the iovecs are all zero +*/ +bool qemu_iovec_is_zero (QEMUIOVector *qiov) +{ +int i; +for (i =0 ; i < qiov->niov; i++) { +size_t offs =QEMU_ALIGN_DOWN (qiov->iov[i].iov_len,4 *sizeof (long )); +uint8_t *ptr = qiov->iov[i].iov_base; +if (offs && !buffer_is_zero (qiov->iov[i].iov_base, offs)) { +return false; + } +for (; offs < qiov->iov[i].iov_len; offs++) { +if (ptr[offs]) { +return false; + } + } + } +return true; +} +void qemu_iovec_destroy (QEMUIOVector *qiov) {assert (qiov->nalloc !=-1 );
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 21/22] blockdev: add a function to parse enum ids from strings
In reply to Kevin WolfFrom: Peter Lieven <[email protected]>
this adds a generic function to recover the enum id of a parameter given as a string.
--- blockdev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
blockdev.c +19 -0
@@ -288,6 +288,25 @@ static int parse_block_error_action(const char *buf, bool is_read, Error **errp) } } +static inline int parse_enum_option (const char *lookup[],const char *buf, +int max,int def,Error **errp) +{ +int i; + +if (!buf) { +return def; + } + +for (i =0 ; i < max; i++) { +if (!strcmp (buf, lookup[i])) { +return i; + } + } + +error_setg (errp,"invalid parameter value: %s" , buf); +return def; +} +static bool check_throttle_config (ThrottleConfig *cfg,Error **errp) {if (throttle_conflicting (cfg)) {
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 22/22] block: optimize zero writes with bdrv_write_zeroes
In reply to Kevin WolfFrom: Peter Lieven <[email protected]>
this patch tries to optimize zero write requests by automatically using bdrv_write_zeroes if it is supported by the format.
This significantly speeds up file system initialization and should speed zero write test used to test backend storage performance.
I ran the following 2 tests on my internal SSD with a 50G QCOW2 container and on an attached iSCSI storage.
a) mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdX
QCOW2 [off] [on] [unmap]
-----
runtime: 14secs 1.1secs 1.1secs filesize: 937M 18M 18M
iSCSI [off] [on] [unmap]
----
runtime: 9.3s 0.9s 0.9s
b) dd if=/dev/zero of=/dev/vdX bs=1M oflag=direct
QCOW2 [off] [on] [unmap]
-----
runtime: 246secs 18secs 18secs filesize: 51G 192K 192K throughput: 203M/s 2.3G/s 2.3G/s
iSCSI* [off] [on] [unmap]
----
runtime: 8mins 45secs 33secs throughput: 106M/s 1.2G/s 1.6G/s allocated: 100% 100% 0%
* The storage was connected via an 1Gbit interface. It seems to internally handle writing zeroes via WRITESAME16 very fast.
--- block.c | 9 ++++++++ block/qapi.c | 1 + blockdev.c | 24 +++++++++++++++++++++ hmp.c | 5 +++++ include/block/block_int.h | 1 + qapi-schema.json | 52 +++++++++++++++++++++++++++++++++------------- qemu-options.hx | 6 ++++++ qmp-commands.hx | 3 +++ tests/qemu-iotests/067.out | 10 ++++----- 9 files changed, 91 insertions(+), 20 deletions(-)
block.c +9 -0
@@ -3289,6 +3289,15 @@ static int coroutine_fn bdrv_aligned_pwritev(BlockDriverState *bs, ret =notifier_with_return_list_notify (&bs->before_write_notifiers, req); +if (!ret && bs->detect_zeroes !=BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF && + !(flags &BDRV_REQ_ZERO_WRITE ) && drv->bdrv_co_write_zeroes && +qemu_iovec_is_zero (qiov)) { + flags |=BDRV_REQ_ZERO_WRITE ; +if (bs->detect_zeroes ==BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP ) { + flags |=BDRV_REQ_MAY_UNMAP ; + } + } +if (ret <0 ) {/* Do nothing, write notifier decided to fail this request */ }else if (flags &BDRV_REQ_ZERO_WRITE ) {
block/qapi.c +1 -0
@@ -50,6 +50,7 @@ BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs) } info->backing_file_depth =bdrv_get_backing_file_depth (bs); + info->detect_zeroes = bs->detect_zeroes;if (bs->io_limits_enabled) {ThrottleConfig cfg;
blockdev.c +24 -0
@@ -343,6 +343,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,QemuOpts *opts;const char *id;bool has_driver_specific_opts; +BlockdevDetectZeroesOptions detect_zeroes;BlockDriver *drv =NULL ;/* Check common options by copying from bs_opts to opts, all other options
@@ -471,6 +472,24 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, } } + detect_zeroes = +parse_enum_option (BlockdevDetectZeroesOptions_lookup, +qemu_opt_get (opts,"detect-zeroes" ), +BLOCKDEV_DETECT_ZEROES_OPTIONS_MAX , +BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF , + &error); +if (error) { +error_propagate (errp, error); + goto early_err; + } + +if (detect_zeroes ==BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP && + !(bdrv_flags &BDRV_O_UNMAP )) { +error_setg (errp,"setting detect-zeroes to unmap is not allowed " +"without setting discard operation to unmap" ); + goto early_err; + } +/* init */ dinfo =g_malloc0 (sizeof (*dinfo)); dinfo->id =g_strdup (qemu_opts_id (opts));
@@ -481,6 +500,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, } dinfo->bdrv->open_flags = snapshot ?BDRV_O_SNAPSHOT :0 ; dinfo->bdrv->read_only = ro; + dinfo->bdrv->detect_zeroes = detect_zeroes; dinfo->refcount =1 ;if (serial !=NULL ) { dinfo->serial =g_strdup (serial);
@@ -2474,6 +2494,10 @@ QemuOptsList qemu_common_drive_opts = { .name = "copy-on-read", .type = QEMU_OPT_BOOL, .help = "copy read data from backing file into image file", + },{ + .name = "detect-zeroes", + .type = QEMU_OPT_STRING, + .help = "try to optimize zero writes (off, on, unmap)", }, {/* end of list */ } },
hmp.c +5 -0
@@ -341,6 +341,11 @@ void hmp_info_block(Monitor *mon, const QDict *qdict) info->value->inserted->backing_file_depth); } +if (info->value->inserted->detect_zeroes !=BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF ) { +monitor_printf (mon," Detect zeroes: %s\n" , + BlockdevDetectZeroesOptions_lookup[info->value->inserted->detect_zeroes]); + } +if (info->value->inserted->bps || info->value->inserted->bps_rd || info->value->inserted->bps_wr
include/block/block_int.h +1 -0
@@ -364,6 +364,7 @@ struct BlockDriverState {BlockJob *job;QDict *options; +BlockdevDetectZeroesOptions detect_zeroes; };int get_tmp_filename (char *filename,int size);
qapi-schema.json +37 -15
82 lines not on this page · raw message
qemu-options.hx +6 -0
@@ -414,6 +414,7 @@ DEF("drive", HAS_ARG, QEMU_OPTION_drive, " [,serial=s][,addr=A][,rerror=ignore|stop|report]\n" " [,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]\n" " [,readonly=on|off][,copy-on-read=on|off]\n" + " [,detect-zeroes=on|off|unmap]\n" " [[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]\n" " [[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]\n" " [[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]\n"
@@ -475,6 +476,11 @@ Open drive @option{file} as read-only. Guest write attempts will fail. @item copy-on-read=@var{copy-on-read} @var{copy-on-read} is "on" or "off" and enables whether to copy read backing file sectors into the image file. +@item detect-zeroes=@var{detect-zeroes} +@var{detect-zeroes} is "off", "on" or "unmap" and enables the automatic +conversion of plain zero writes by the OS to driver specific optimized +zero write commands. You may even choose "unmap" if @var{discard} is set +to "unmap" to allow a zero write to be converted to an UNMAP operation. @end table By default, the @option{cache=writeback} mode is used. It will report data
qmp-commands.hx +3 -0
@@ -2032,6 +2032,8 @@ Each json-object contain the following: - "iops_rd_max": read I/O operations max (json-int) - "iops_wr_max": write I/O operations max (json-int) - "iops_size": I/O size when limiting by iops (json-int) + - "detect_zeroes": detect and optimize zero writing (json-string) + - Possible values: "off", "on", "unmap" - "image": the detail of the image, it is a json-object containing the following: - "filename": image file name (json-string)
@@ -2108,6 +2110,7 @@ Example: "iops_rd_max": 0, "iops_wr_max": 0, "iops_size": 0, + "detect_zeroes": "on", "image":{ "filename":"disks/test.qcow2", "format":"qcow2",
tests/qemu-iotests/067.out +5 -5
@@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virtio-blk-pci,drive=disk,id=virtio0 QMP_VERSION {"return": {}} -{"return": [{"io-status": "ok", "device": "disk", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}]} +{"return": [{"io-status": "ok", "device": "disk", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}]} {"return": {}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/virtio0/virtio-backend"}}
@@ -24,7 +24,7 @@ QMP_VERSION Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk QMP_VERSION {"return": {}} -{"return": [{"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}]} +{"return": [{"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}]} {"return": {}} {"return": {}} {"return": {}}
@@ -44,7 +44,7 @@ Testing: QMP_VERSION {"return": {}} {"return": "OK\r\n"} -{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} +{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} {"return": {}} {"return": {}} {"return": {}}
@@ -64,14 +64,14 @@ Testing: QMP_VERSION {"return": {}} {"return": {}} -{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} +{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} {"return": {}} {"return": {}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/virtio0/virtio-backend"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_DELETED", "data": {"device": "virtio0", "path": "/machine/peripheral/virtio0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "RESET"} -{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} +{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open": false, "type": "unknown"}, {"io-status": "ok", "device": "disk", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 4 lines · Kevin Wolf
The following changes since commit
1a381811b495651ddfc2b50d7c8cfaaf375816b0:Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-s390-20140515' into staging (2014-05-15 18:56:08 +0100)
Quoted 8 lines
are available in the git repository at:
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
465bee1da82e43f18d10c43cc7566d0284ad13a9:block: optimize zero writes with
bdrv_write_zeroes(2014-05-19 13:42:27 +0200)
Applied, thanks.
-- PMM