2013-01-29 13:46:52 +04:00
|
|
|
QA output created by 049
|
|
|
|
=== Check correct interpretation of suffixes for image size ===
|
|
|
|
|
|
|
|
== 1. Traditional size parameter ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024b
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1k
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1K
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1G
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1T
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0b
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5k
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5K
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5G
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5T
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== 2. Specifying size via -o ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1024 TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1024b TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1k TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1K TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1M TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1048576 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1G TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1073741824 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1T TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1099511627776 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1024.0 TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1024.0b TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1024 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1.5k TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1.5K TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1536 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1.5M TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1572864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1.5G TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1610612736 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1.5T TEST_DIR/t.qcow2
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=1649267441664 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== 3. Invalid sizes ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1024
|
utils: Improve qemu_strtosz() to have 64 bits of precision
We have multiple clients of qemu_strtosz (qemu-io, the opts visitor,
the keyval visitor), and it gets annoying that edge-case testing is
impacted by implicit rounding to 53 bits of precision due to parsing
with strtod(). As an example posted by Rich Jones:
$ nbdkit memory $(( 2**63 - 2**30 )) --run \
'build/qemu-io -f raw "$uri" -c "w -P 3 $(( 2**63 - 2**30 - 512 )) 512" '
write failed: Input/output error
because 9223372035781033472 got rounded to 0x7fffffffc0000000 which is
out of bounds.
It is also worth noting that our existing parser, by virtue of using
strtod(), accepts decimal AND hex numbers, even though test-cutils
previously lacked any coverage of the latter until the previous patch.
We do have existing clients that expect a hex parse to work (for
example, iotest 33 using qemu-io -c "write -P 0xa 0x200 0x400"), but
strtod() parses "08" as 8 rather than as an invalid octal number, so
we know there are no clients that depend on octal. Our use of
strtod() also means that "0x1.8k" would actually parse as 1536 (the
fraction is 8/16), rather than 1843 (if the fraction were 8/10); but
as this was not covered in the testsuite, I have no qualms forbidding
hex fractions as invalid, so this patch declares that the use of
fractions is only supported with decimal input, and enhances the
testsuite to document that.
Our previous use of strtod() meant that -1 parsed as a negative; now
that we parse with strtoull(), negative values can wrap around modulo
2^64, so we have to explicitly check whether the user passed in a '-';
and make it consistent to also reject '-0'. This has the minor effect
of treating negative values as EINVAL (with no change to endptr)
rather than ERANGE (with endptr advanced to what was parsed), visible
in the updated iotest output.
We also had no testsuite coverage of "1.1e0k", which happened to parse
under strtod() but is unlikely to occur in practice; as long as we are
making things more robust, it is easy enough to reject the use of
exponents in a strtod parse.
The fix is done by breaking the parse into an integer prefix (no loss
in precision), rejecting negative values (since we can no longer rely
on strtod() to do that), determining if a decimal or hexadecimal parse
was intended (with the new restriction that a fractional hex parse is
not allowed), and where appropriate, using a floating point fractional
parse (where we also scan to reject use of exponents in the fraction).
The bulk of the patch is then updates to the testsuite to match our
new precision, as well as adding new cases we reject (whether they
were rejected or inadvertently accepted before).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210211204438.1184395-3-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-11 23:44:36 +03:00
|
|
|
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
|
|
|
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=-1024 TEST_DIR/t.qcow2
|
utils: Improve qemu_strtosz() to have 64 bits of precision
We have multiple clients of qemu_strtosz (qemu-io, the opts visitor,
the keyval visitor), and it gets annoying that edge-case testing is
impacted by implicit rounding to 53 bits of precision due to parsing
with strtod(). As an example posted by Rich Jones:
$ nbdkit memory $(( 2**63 - 2**30 )) --run \
'build/qemu-io -f raw "$uri" -c "w -P 3 $(( 2**63 - 2**30 - 512 )) 512" '
write failed: Input/output error
because 9223372035781033472 got rounded to 0x7fffffffc0000000 which is
out of bounds.
It is also worth noting that our existing parser, by virtue of using
strtod(), accepts decimal AND hex numbers, even though test-cutils
previously lacked any coverage of the latter until the previous patch.
We do have existing clients that expect a hex parse to work (for
example, iotest 33 using qemu-io -c "write -P 0xa 0x200 0x400"), but
strtod() parses "08" as 8 rather than as an invalid octal number, so
we know there are no clients that depend on octal. Our use of
strtod() also means that "0x1.8k" would actually parse as 1536 (the
fraction is 8/16), rather than 1843 (if the fraction were 8/10); but
as this was not covered in the testsuite, I have no qualms forbidding
hex fractions as invalid, so this patch declares that the use of
fractions is only supported with decimal input, and enhances the
testsuite to document that.
Our previous use of strtod() meant that -1 parsed as a negative; now
that we parse with strtoull(), negative values can wrap around modulo
2^64, so we have to explicitly check whether the user passed in a '-';
and make it consistent to also reject '-0'. This has the minor effect
of treating negative values as EINVAL (with no change to endptr)
rather than ERANGE (with endptr advanced to what was parsed), visible
in the updated iotest output.
We also had no testsuite coverage of "1.1e0k", which happened to parse
under strtod() but is unlikely to occur in practice; as long as we are
making things more robust, it is easy enough to reject the use of
exponents in a strtod parse.
The fix is done by breaking the parse into an integer prefix (no loss
in precision), rejecting negative values (since we can no longer rely
on strtod() to do that), determining if a decimal or hexadecimal parse
was intended (with the new restriction that a fractional hex parse is
not allowed), and where appropriate, using a floating point fractional
parse (where we also scan to reject use of exponents in the fraction).
The bulk of the patch is then updates to the testsuite to match our
new precision, as well as adding new cases we reject (whether they
were rejected or inadvertently accepted before).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210211204438.1184395-3-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-11 23:44:36 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Parameter 'size' expects a non-negative number below 2^64
|
|
|
|
Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
|
|
|
|
and exabytes, respectively.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1k
|
utils: Improve qemu_strtosz() to have 64 bits of precision
We have multiple clients of qemu_strtosz (qemu-io, the opts visitor,
the keyval visitor), and it gets annoying that edge-case testing is
impacted by implicit rounding to 53 bits of precision due to parsing
with strtod(). As an example posted by Rich Jones:
$ nbdkit memory $(( 2**63 - 2**30 )) --run \
'build/qemu-io -f raw "$uri" -c "w -P 3 $(( 2**63 - 2**30 - 512 )) 512" '
write failed: Input/output error
because 9223372035781033472 got rounded to 0x7fffffffc0000000 which is
out of bounds.
It is also worth noting that our existing parser, by virtue of using
strtod(), accepts decimal AND hex numbers, even though test-cutils
previously lacked any coverage of the latter until the previous patch.
We do have existing clients that expect a hex parse to work (for
example, iotest 33 using qemu-io -c "write -P 0xa 0x200 0x400"), but
strtod() parses "08" as 8 rather than as an invalid octal number, so
we know there are no clients that depend on octal. Our use of
strtod() also means that "0x1.8k" would actually parse as 1536 (the
fraction is 8/16), rather than 1843 (if the fraction were 8/10); but
as this was not covered in the testsuite, I have no qualms forbidding
hex fractions as invalid, so this patch declares that the use of
fractions is only supported with decimal input, and enhances the
testsuite to document that.
Our previous use of strtod() meant that -1 parsed as a negative; now
that we parse with strtoull(), negative values can wrap around modulo
2^64, so we have to explicitly check whether the user passed in a '-';
and make it consistent to also reject '-0'. This has the minor effect
of treating negative values as EINVAL (with no change to endptr)
rather than ERANGE (with endptr advanced to what was parsed), visible
in the updated iotest output.
We also had no testsuite coverage of "1.1e0k", which happened to parse
under strtod() but is unlikely to occur in practice; as long as we are
making things more robust, it is easy enough to reject the use of
exponents in a strtod parse.
The fix is done by breaking the parse into an integer prefix (no loss
in precision), rejecting negative values (since we can no longer rely
on strtod() to do that), determining if a decimal or hexadecimal parse
was intended (with the new restriction that a fractional hex parse is
not allowed), and where appropriate, using a floating point fractional
parse (where we also scan to reject use of exponents in the fraction).
The bulk of the patch is then updates to the testsuite to match our
new precision, as well as adding new cases we reject (whether they
were rejected or inadvertently accepted before).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210211204438.1184395-3-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-11 23:44:36 +03:00
|
|
|
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
|
|
|
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=-1k TEST_DIR/t.qcow2
|
utils: Improve qemu_strtosz() to have 64 bits of precision
We have multiple clients of qemu_strtosz (qemu-io, the opts visitor,
the keyval visitor), and it gets annoying that edge-case testing is
impacted by implicit rounding to 53 bits of precision due to parsing
with strtod(). As an example posted by Rich Jones:
$ nbdkit memory $(( 2**63 - 2**30 )) --run \
'build/qemu-io -f raw "$uri" -c "w -P 3 $(( 2**63 - 2**30 - 512 )) 512" '
write failed: Input/output error
because 9223372035781033472 got rounded to 0x7fffffffc0000000 which is
out of bounds.
It is also worth noting that our existing parser, by virtue of using
strtod(), accepts decimal AND hex numbers, even though test-cutils
previously lacked any coverage of the latter until the previous patch.
We do have existing clients that expect a hex parse to work (for
example, iotest 33 using qemu-io -c "write -P 0xa 0x200 0x400"), but
strtod() parses "08" as 8 rather than as an invalid octal number, so
we know there are no clients that depend on octal. Our use of
strtod() also means that "0x1.8k" would actually parse as 1536 (the
fraction is 8/16), rather than 1843 (if the fraction were 8/10); but
as this was not covered in the testsuite, I have no qualms forbidding
hex fractions as invalid, so this patch declares that the use of
fractions is only supported with decimal input, and enhances the
testsuite to document that.
Our previous use of strtod() meant that -1 parsed as a negative; now
that we parse with strtoull(), negative values can wrap around modulo
2^64, so we have to explicitly check whether the user passed in a '-';
and make it consistent to also reject '-0'. This has the minor effect
of treating negative values as EINVAL (with no change to endptr)
rather than ERANGE (with endptr advanced to what was parsed), visible
in the updated iotest output.
We also had no testsuite coverage of "1.1e0k", which happened to parse
under strtod() but is unlikely to occur in practice; as long as we are
making things more robust, it is easy enough to reject the use of
exponents in a strtod parse.
The fix is done by breaking the parse into an integer prefix (no loss
in precision), rejecting negative values (since we can no longer rely
on strtod() to do that), determining if a decimal or hexadecimal parse
was intended (with the new restriction that a fractional hex parse is
not allowed), and where appropriate, using a floating point fractional
parse (where we also scan to reject use of exponents in the fraction).
The bulk of the patch is then updates to the testsuite to match our
new precision, as well as adding new cases we reject (whether they
were rejected or inadvertently accepted before).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210211204438.1184395-3-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-02-11 23:44:36 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Parameter 'size' expects a non-negative number below 2^64
|
|
|
|
Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
|
|
|
|
and exabytes, respectively.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- 1kilobyte
|
2020-05-13 16:36:26 +03:00
|
|
|
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
2013-06-05 16:19:27 +04:00
|
|
|
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=1kilobyte TEST_DIR/t.qcow2
|
2018-10-17 11:27:00 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Parameter 'size' expects a non-negative number below 2^64
|
2017-02-27 15:55:43 +03:00
|
|
|
Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
|
|
|
|
and exabytes, respectively.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- foobar
|
2020-05-13 16:36:26 +03:00
|
|
|
qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
|
2013-06-05 16:19:27 +04:00
|
|
|
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=foobar TEST_DIR/t.qcow2
|
2018-10-17 11:27:00 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Parameter 'size' expects a non-negative number below 2^64
|
2017-02-27 15:55:43 +03:00
|
|
|
Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
|
|
|
|
and exabytes, respectively.
|
2013-01-29 13:46:52 +04:00
|
|
|
|
2019-11-26 18:45:49 +03:00
|
|
|
== 4. Specify size twice (-o and traditional parameter) ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o size=10M TEST_DIR/t.qcow2 20M
|
|
|
|
qemu-img: TEST_DIR/t.qcow2: The image size must be specified only once
|
|
|
|
|
2013-01-29 13:46:52 +04:00
|
|
|
== Check correct interpretation of suffixes for cluster size ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1024 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1024b TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1k TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1K TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1M TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1048576 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1024.0 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=1024.0b TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=1024 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=0.5k TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=0.5K TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=512 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o cluster_size=0.5M TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=524288 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== Check compat level option ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=0.10 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=1.1 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=0.42 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.42 lazy_refcounts=off refcount_bits=16
|
2020-07-06 23:39:45 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Invalid parameter '0.42'
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=foobar TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=foobar lazy_refcounts=off refcount_bits=16
|
2020-07-06 23:39:45 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Invalid parameter 'foobar'
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== Check preallocation option ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o preallocation=off TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o preallocation=metadata TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=metadata compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o preallocation=1234 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off preallocation=1234 compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2020-07-06 23:39:45 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Invalid parameter '1234'
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== Check encryption option ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o encryption=off TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=off cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
2017-06-23 19:24:10 +03:00
|
|
|
qemu-img create -f qcow2 --object secret,id=sec0,data=123456 -o encryption=on,encrypt.key-secret=sec0 TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 encryption=on encrypt.key-secret=sec0 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
== Check lazy_refcounts option (only with v3) ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=off TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=1.1 lazy_refcounts=on refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=off TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=off refcount_bits=16
|
2013-01-29 13:46:52 +04:00
|
|
|
|
|
|
|
qemu-img create -f qcow2 -o compat=0.10,lazy_refcounts=on TEST_DIR/t.qcow2 64M
|
2020-07-10 19:13:13 +03:00
|
|
|
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 compat=0.10 lazy_refcounts=on refcount_bits=16
|
2020-07-06 23:39:45 +03:00
|
|
|
qemu-img: TEST_DIR/t.qcow2: Lazy refcounts only supported with compatibility level 1.1 and above (use version=v3 or greater)
|
2013-01-29 13:46:52 +04:00
|
|
|
|
2020-08-13 16:47:22 +03:00
|
|
|
== Expect error when backing file name is empty string ==
|
|
|
|
|
|
|
|
qemu-img create -f qcow2 -b TEST_DIR/t.qcow2 1M
|
|
|
|
qemu-img: TEST_DIR/t.qcow2: Expected backing file name, got empty string
|
|
|
|
|
2013-01-29 13:46:52 +04:00
|
|
|
*** done
|