Patchwork qemu-iotests: Test qcow2 image creation options

login
register
mail settings
Submitter Kevin Wolf
Date Jan. 29, 2013, 10:01 a.m.
Message ID <1359453675-13449-1-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/216484/
State New
Headers show

Comments

Kevin Wolf - Jan. 29, 2013, 10:01 a.m.
Just create lots of images and try out each of the creation options that
qcow2 provides (except backing_file/fmt for now)

I'm not totally happy with the behaviour of qemu-img in each of the
cases, but let's be explicit and update the test when we do change
things later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/048     |  117 ++++++++++++++++++++++++
 tests/qemu-iotests/048.out |  213 ++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/group   |    1 +
 3 files changed, 331 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests/048
 create mode 100644 tests/qemu-iotests/048.out
Markus Armbruster - Jan. 29, 2013, 1:43 p.m.
Kevin Wolf <kwolf@redhat.com> writes:

> Just create lots of images and try out each of the creation options that
> qcow2 provides (except backing_file/fmt for now)
>
> I'm not totally happy with the behaviour of qemu-img in each of the
> cases, but let's be explicit and update the test when we do change
> things later.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/048     |  117 ++++++++++++++++++++++++
>  tests/qemu-iotests/048.out |  213 ++++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/group   |    1 +
>  3 files changed, 331 insertions(+), 0 deletions(-)
>  create mode 100755 tests/qemu-iotests/048
>  create mode 100644 tests/qemu-iotests/048.out
>
> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
> new file mode 100755
> index 0000000..89d3d32
> --- /dev/null
> +++ b/tests/qemu-iotests/048
> @@ -0,0 +1,117 @@
> +#!/bin/bash
> +#
> +# Check qemu-img option parsing
> +#
> +# Copyright (C) 2013 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`
> +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
> +
> +function test_qemu_img()
> +{
> +    echo qemu-img "$@"
> +    $QEMU_IMG "$@"
> +    echo
> +}
> +
> +echo "=== Check correct interpretation of suffixes for image size ==="
> +echo
> +sizes="1024 1024b 1k 1K 1M 1G 1T "
> +sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
> +
> +echo "== 1. Traditional size parameter =="
> +echo
> +for s in $sizes; do
> +    test_qemu_img create -f $IMGFMT $TEST_IMG $s
> +done

Do we have a qemu-option.c unit test?  If not, should we have one?

Even if yes, testing qemu-img like this still makes sense.  But fewer
test cases could do.

> +
> +echo "== 2. Specifying size via -o =="
> +echo
> +for s in $sizes; do
> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
> +done
> +
> +echo "== 3. Invalid sizes =="
> +echo
> +sizes="-1024 -1k 1kilobyte foobar"
> +
> +for s in $sizes; do
> +    test_qemu_img create -f $IMGFMT $TEST_IMG -- $s
> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
> +done

Valid sizes are tested in two loops, one for size parameter, one for -o,
invalid sizes in a single combined loop.  I don't mind, I just find it
odd.

> +
> +echo "== Check correct interpretation of suffixes for cluster size =="
> +echo
> +sizes="1024 1024b 1k 1K 1M "
> +sizes+="1024.0 1024.0b 0.5k 0.5K 0.5M"
> +
> +for s in $sizes; do
> +    test_qemu_img create -f $IMGFMT -o cluster_size=$s $TEST_IMG 64M
> +done
> +
> +echo "== Check compat level option =="
> +echo
> +test_qemu_img create -f $IMGFMT -o compat=0.10 $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o compat=1.1 $TEST_IMG 64M
> +
> +test_qemu_img create -f $IMGFMT -o compat=0.42 $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o compat=foobar $TEST_IMG 64M
> +
> +echo "== Check preallocation option =="
> +echo
> +test_qemu_img create -f $IMGFMT -o preallocation=off $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o preallocation=metadata $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o preallocation=1234 $TEST_IMG 64M
> +
> +echo "== Check encryption option =="
> +echo
> +test_qemu_img create -f $IMGFMT -o encryption=off $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o encryption=on $TEST_IMG 64M
> +
> +echo "== Check lazy_refcounts option (only with v3) =="
> +echo
> +test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=off $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=on $TEST_IMG 64M
> +
> +test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=off $TEST_IMG 64M
> +test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=on $TEST_IMG 64M
> +
> +# success, all done
> +echo "*** done"
> +rm -f $seq.full
> +status=0

Let's examine coverage:

    #define BLOCK_OPT_SIZE              "size"
    Check

    #define BLOCK_OPT_ENCRYPT           "encryption"
    Check

    #define BLOCK_OPT_COMPAT6           "compat6"
    Not covered, only used by vmdk.

    #define BLOCK_OPT_BACKING_FILE      "backing_file"
    Not covered, mentioned in commit message.  Okay.

    #define BLOCK_OPT_BACKING_FMT       "backing_fmt"
    Likewise

    #define BLOCK_OPT_CLUSTER_SIZE      "cluster_size"
    Check

    #define BLOCK_OPT_TABLE_SIZE        "table_size"
    Not covered, only used by qed.

    #define BLOCK_OPT_PREALLOC          "preallocation"
    Check

    #define BLOCK_OPT_SUBFMT            "subformat"
    Not covered, used by vmdk and vpc.

    #define BLOCK_OPT_COMPAT_LEVEL      "compat"
    Check

    #define BLOCK_OPT_LAZY_REFCOUNTS    "lazy_refcounts"
    Check

Good enough for me, and matches commit message.

> diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
> new file mode 100644
> index 0000000..8569f3e
> --- /dev/null
> +++ b/tests/qemu-iotests/048.out
[...]

I figure this is simply current output, and we assume it's good.

> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
> index 1bbd2bf..a4175b2 100644
> --- a/tests/qemu-iotests/group
> +++ b/tests/qemu-iotests/group
> @@ -54,3 +54,4 @@
>  045 rw auto
>  046 rw auto aio
>  047 rw auto
> +048 rw auto

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Kevin Wolf - Jan. 29, 2013, 1:55 p.m.
Am 29.01.2013 14:43, schrieb Markus Armbruster:
>> +echo "=== Check correct interpretation of suffixes for image size ==="
>> +echo
>> +sizes="1024 1024b 1k 1K 1M 1G 1T "
>> +sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
>> +
>> +echo "== 1. Traditional size parameter =="
>> +echo
>> +for s in $sizes; do
>> +    test_qemu_img create -f $IMGFMT $TEST_IMG $s
>> +done
> 
> Do we have a qemu-option.c unit test?  If not, should we have one?

Not that I am aware of. Writing unit tests for QemuOpts would probably
make sense, but I suppose it's not worth the effort for the
QemuOptionParameters stuff that we're going to remove anyway.

> Even if yes, testing qemu-img like this still makes sense.  But fewer
> test cases could do.

Not sure. This test case is mainly meant to ensure that the behaviour
stays consistent even if we move to a different infrastructure
(QemuOptionParameter -> QemuOpts). It wouldn't be enough to test that
each of these is working correctly for itself.

>> +
>> +echo "== 2. Specifying size via -o =="
>> +echo
>> +for s in $sizes; do
>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>> +done
>> +
>> +echo "== 3. Invalid sizes =="
>> +echo
>> +sizes="-1024 -1k 1kilobyte foobar"
>> +
>> +for s in $sizes; do
>> +    test_qemu_img create -f $IMGFMT $TEST_IMG -- $s
>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>> +done
> 
> Valid sizes are tested in two loops, one for size parameter, one for -o,
> invalid sizes in a single combined loop.  I don't mind, I just find it
> odd.

The reason for having separate loops for valid sizes is mostly to keep
the output readable. There are much more valid sizes tested than invalid
ones.

>> diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
>> new file mode 100644
>> index 0000000..8569f3e
>> --- /dev/null
>> +++ b/tests/qemu-iotests/048.out
> [...]
> 
> I figure this is simply current output, and we assume it's good.

Yes, it is. And for some values of good (for example, the output for
negative sizes is creative, to say the least)

Kevin
Markus Armbruster - Jan. 29, 2013, 2:16 p.m.
Kevin Wolf <kwolf@redhat.com> writes:

> Am 29.01.2013 14:43, schrieb Markus Armbruster:
>>> +echo "=== Check correct interpretation of suffixes for image size ==="
>>> +echo
>>> +sizes="1024 1024b 1k 1K 1M 1G 1T "
>>> +sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
>>> +
>>> +echo "== 1. Traditional size parameter =="
>>> +echo
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT $TEST_IMG $s
>>> +done
>> 
>> Do we have a qemu-option.c unit test?  If not, should we have one?
>
> Not that I am aware of. Writing unit tests for QemuOpts would probably
> make sense, but I suppose it's not worth the effort for the
> QemuOptionParameters stuff that we're going to remove anyway.

Yes.

>> Even if yes, testing qemu-img like this still makes sense.  But fewer
>> test cases could do.
>
> Not sure. This test case is mainly meant to ensure that the behaviour
> stays consistent even if we move to a different infrastructure
> (QemuOptionParameter -> QemuOpts). It wouldn't be enough to test that
> each of these is working correctly for itself.

Makes sense.

>>> +
>>> +echo "== 2. Specifying size via -o =="
>>> +echo
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>>> +done
>>> +
>>> +echo "== 3. Invalid sizes =="
>>> +echo
>>> +sizes="-1024 -1k 1kilobyte foobar"
>>> +
>>> +for s in $sizes; do
>>> +    test_qemu_img create -f $IMGFMT $TEST_IMG -- $s
>>> +    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
>>> +done
>> 
>> Valid sizes are tested in two loops, one for size parameter, one for -o,
>> invalid sizes in a single combined loop.  I don't mind, I just find it
>> odd.
>
> The reason for having separate loops for valid sizes is mostly to keep
> the output readable. There are much more valid sizes tested than invalid
> ones.
>
>>> diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
>>> new file mode 100644
>>> index 0000000..8569f3e
>>> --- /dev/null
>>> +++ b/tests/qemu-iotests/048.out
>> [...]
>> 
>> I figure this is simply current output, and we assume it's good.
>
> Yes, it is. And for some values of good (for example, the output for
> negative sizes is creative, to say the least)

"-o size=-1" is good one, too :)
Kevin Wolf - Jan. 29, 2013, 2:59 p.m.
Am 29.01.2013 11:01, schrieb Kevin Wolf:
> Just create lots of images and try out each of the creation options that
> qcow2 provides (except backing_file/fmt for now)
> 
> I'm not totally happy with the behaviour of qemu-img in each of the
> cases, but let's be explicit and update the test when we do change
> things later.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Self-NAK.

The golden output shouldn't have references to /home/kwolf/...

Kevin
Eric Blake - Jan. 29, 2013, 4:12 p.m.
On 01/29/2013 03:01 AM, Kevin Wolf wrote:
> Just create lots of images and try out each of the creation options that
> qcow2 provides (except backing_file/fmt for now)
> 
> I'm not totally happy with the behaviour of qemu-img in each of the
> cases, but let's be explicit and update the test when we do change
> things later.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---

> @@ -0,0 +1,117 @@
> +#!/bin/bash

Good, because you definitely used some bash-isms (such as sizes+="more").

> +# creator
> +owner=kwolf@redhat.com
> +
> +seq=`basename $0`

Since you are already using a capable shell, why not go all the way and
use $() instead of ``?  And in this case, why not:

seq=${0##*/}

to avoid a fork?

> +echo "QA output created by $seq"
> +
> +here=`pwd`

Likewise, since you are using a capable shell, you can avoid a fork:

here=$PWD

> +tmp=/tmp/$$

And since you are using a capable shell, it would be more secure to use:

tmp=/tmp/$$.$RANDOM

> +status=1	# failure is the default!
> +
> +_cleanup()
> +{

POSIX-style declaration,...

> +	_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
> +
> +function test_qemu_img()

...bash-style declaration.  I generally frown on the use of 'function'
in shell scripts, as it is not portable, and takes up more screen-space
than the POSIX style.
Kevin Wolf - Jan. 29, 2013, 4:21 p.m.
Am 29.01.2013 17:12, schrieb Eric Blake:
> On 01/29/2013 03:01 AM, Kevin Wolf wrote:
>> Just create lots of images and try out each of the creation options that
>> qcow2 provides (except backing_file/fmt for now)
>>
>> I'm not totally happy with the behaviour of qemu-img in each of the
>> cases, but let's be explicit and update the test when we do change
>> things later.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
> 
>> @@ -0,0 +1,117 @@
>> +#!/bin/bash
> 
> Good, because you definitely used some bash-isms (such as sizes+="more").
> 
>> +# creator
>> +owner=kwolf@redhat.com
>> +
>> +seq=`basename $0`
> 
> Since you are already using a capable shell, why not go all the way and
> use $() instead of ``?  

I would have if this wasn't only code copied from other test cases.
(Same thing below: the POSIX function is copied, the bash one is new)

> And in this case, why not:
> 
> seq=${0##*/}
> 
> to avoid a fork?

Because I can't read that and one fork more or less really makes no
difference. :-) (and it's copied as well)

>> +echo "QA output created by $seq"
>> +
>> +here=`pwd`
> 
> Likewise, since you are using a capable shell, you can avoid a fork:
> 
> here=$PWD
> 
>> +tmp=/tmp/$$
> 
> And since you are using a capable shell, it would be more secure to use:
> 
> tmp=/tmp/$$.$RANDOM

Both of them are copied.

If you really care about any of them, you should probably submit a patch
that fixes it in all test cases - otherwise I'll again copy one of the
wrong versions next time.

Kevin

Patch

diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
new file mode 100755
index 0000000..89d3d32
--- /dev/null
+++ b/tests/qemu-iotests/048
@@ -0,0 +1,117 @@ 
+#!/bin/bash
+#
+# Check qemu-img option parsing
+#
+# Copyright (C) 2013 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`
+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
+
+function test_qemu_img()
+{
+    echo qemu-img "$@"
+    $QEMU_IMG "$@"
+    echo
+}
+
+echo "=== Check correct interpretation of suffixes for image size ==="
+echo
+sizes="1024 1024b 1k 1K 1M 1G 1T "
+sizes+="1024.0 1024.0b 1.5k 1.5K 1.5M 1.5G 1.5T"
+
+echo "== 1. Traditional size parameter =="
+echo
+for s in $sizes; do
+    test_qemu_img create -f $IMGFMT $TEST_IMG $s
+done
+
+echo "== 2. Specifying size via -o =="
+echo
+for s in $sizes; do
+    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
+done
+
+echo "== 3. Invalid sizes =="
+echo
+sizes="-1024 -1k 1kilobyte foobar"
+
+for s in $sizes; do
+    test_qemu_img create -f $IMGFMT $TEST_IMG -- $s
+    test_qemu_img create -f $IMGFMT -o size=$s $TEST_IMG
+done
+
+echo "== Check correct interpretation of suffixes for cluster size =="
+echo
+sizes="1024 1024b 1k 1K 1M "
+sizes+="1024.0 1024.0b 0.5k 0.5K 0.5M"
+
+for s in $sizes; do
+    test_qemu_img create -f $IMGFMT -o cluster_size=$s $TEST_IMG 64M
+done
+
+echo "== Check compat level option =="
+echo
+test_qemu_img create -f $IMGFMT -o compat=0.10 $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o compat=1.1 $TEST_IMG 64M
+
+test_qemu_img create -f $IMGFMT -o compat=0.42 $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o compat=foobar $TEST_IMG 64M
+
+echo "== Check preallocation option =="
+echo
+test_qemu_img create -f $IMGFMT -o preallocation=off $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o preallocation=metadata $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o preallocation=1234 $TEST_IMG 64M
+
+echo "== Check encryption option =="
+echo
+test_qemu_img create -f $IMGFMT -o encryption=off $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o encryption=on $TEST_IMG 64M
+
+echo "== Check lazy_refcounts option (only with v3) =="
+echo
+test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=off $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o compat=1.1,lazy_refcounts=on $TEST_IMG 64M
+
+test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=off $TEST_IMG 64M
+test_qemu_img create -f $IMGFMT -o compat=0.10,lazy_refcounts=on $TEST_IMG 64M
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
new file mode 100644
index 0000000..8569f3e
--- /dev/null
+++ b/tests/qemu-iotests/048.out
@@ -0,0 +1,213 @@ 
+QA output created by 048
+=== Check correct interpretation of suffixes for image size ===
+
+== 1. Traditional size parameter ==
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1024
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1024b
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1k
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1K
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1048576 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1G
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1T
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1099511627776 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1024.0
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1024.0b
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1.5k
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1536 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1.5K
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1536 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1.5M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1572864 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1.5G
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1610612736 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 1.5T
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1649267441664 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+== 2. Specifying size via -o ==
+
+qemu-img create -f qcow2 -o size=1024 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1024b /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1k /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1K /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1M /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1048576 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1G /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1T /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1099511627776 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1024.0 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1024.0b /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1.5k /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1536 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1.5K /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1536 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1.5M /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1572864 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1.5G /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1610612736 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o size=1.5T /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1649267441664 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+== 3. Invalid sizes ==
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 -- -1024
+qemu-img: Image size must be less than 8 EiB!
+
+qemu-img create -f qcow2 -o size=-1024 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+qemu-img: qcow2 doesn't support shrinking images yet
+qemu-img: Formatting or formatting option not supported for file format 'qcow2'
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=-1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 -- -1k
+qemu-img: Image size must be less than 8 EiB!
+
+qemu-img create -f qcow2 -o size=-1k /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+qemu-img: qcow2 doesn't support shrinking images yet
+qemu-img: Formatting or formatting option not supported for file format 'qcow2'
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=-1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 -- 1kilobyte
+qemu-img: Invalid image size specified! You may use k, M, G or T suffixes for 
+qemu-img: kilobytes, megabytes, gigabytes and terabytes.
+
+qemu-img create -f qcow2 -o size=1kilobyte /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=1024 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 -- foobar
+qemu-img: Invalid image size specified! You may use k, M, G or T suffixes for 
+qemu-img: kilobytes, megabytes, gigabytes and terabytes.
+
+qemu-img create -f qcow2 -o size=foobar /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2
+You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.
+qemu-img: Parameter 'size' expects a size
+qemu-img: Invalid options for file format 'qcow2'.
+
+== Check correct interpretation of suffixes for cluster size ==
+
+qemu-img create -f qcow2 -o cluster_size=1024 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1024b /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1k /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1K /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1M /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1048576 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1024.0 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=1024.0b /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=1024 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=0.5k /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=512 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=0.5K /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=512 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o cluster_size=0.5M /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=524288 lazy_refcounts=off 
+
+== Check compat level option ==
+
+qemu-img create -f qcow2 -o compat=0.10 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o compat=1.1 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o compat=0.42 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Invalid compatibility level: '0.42'
+qemu-img: /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2: error while creating qcow2: Invalid argument
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='0.42' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o compat=foobar /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Invalid compatibility level: 'foobar'
+qemu-img: /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2: error while creating qcow2: Invalid argument
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='foobar' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+== Check preallocation option ==
+
+qemu-img create -f qcow2 -o preallocation=off /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='off' lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o preallocation=metadata /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='metadata' lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o preallocation=1234 /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Invalid preallocation mode: '1234'
+qemu-img: /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2: error while creating qcow2: Invalid argument
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 preallocation='1234' lazy_refcounts=off 
+
+== Check encryption option ==
+
+qemu-img create -f qcow2 -o encryption=off /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o encryption=on /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 encryption=on cluster_size=65536 lazy_refcounts=off 
+
+== Check lazy_refcounts option (only with v3) ==
+
+qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=off /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='1.1' encryption=off cluster_size=65536 lazy_refcounts=on 
+
+qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=off /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=off 
+
+qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=on /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2 64M
+Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
+qemu-img: /home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2: error while creating qcow2: Invalid argument
+Formatting '/home/kwolf/source/qemu/tests/qemu-iotests/scratch/t.qcow2', fmt=qcow2 size=67108864 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=on 
+
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 1bbd2bf..a4175b2 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -54,3 +54,4 @@ 
 045 rw auto
 046 rw auto aio
 047 rw auto
+048 rw auto