mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
block: Add Error parameter to bdrv_amend_options
Looking at the qcow2 code that is riddled with error_report() calls, this is really how it should have been from the start. Along the way, turn the target_version/current_version comparisons at the beginning of qcow2_downgrade() into assertions (the caller has to make sure these conditions are met), and rephrase the error message on using compat=1.1 to get refcount widths other than 16 bits. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20180509210023.20283-3-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
1f996683ad
commit
d1402b5026
9 changed files with 58 additions and 52 deletions
|
@ -129,7 +129,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|||
wrote 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 index: 0); further corruption events will be suppressed
|
||||
qemu-img: Error while amending options: Input/output error
|
||||
qemu-img: Failed to turn zero into data clusters: Input/output error
|
||||
|
||||
=== Testing unaligned L2 entry ===
|
||||
|
||||
|
@ -145,7 +145,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|||
wrote 65536/65536 bytes at offset 0
|
||||
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
|
||||
qemu-img: Error while amending options: Input/output error
|
||||
qemu-img: Failed to turn zero into data clusters: Input/output error
|
||||
|
||||
=== Testing unaligned reftable entry ===
|
||||
|
||||
|
|
|
@ -358,18 +358,12 @@ No errors were found on the image.
|
|||
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
||||
qemu-img: Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
qemu-img: Lazy refcounts only supported with compatibility level 1.1 and above (use compat=1.1 or greater)
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
qemu-img: Unknown compatibility level 0.42
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
qemu-img: Invalid parameter 'foo'
|
||||
qemu-img: Changing the cluster size is not supported
|
||||
qemu-img: Error while amending options: Operation not supported
|
||||
qemu-img: Changing the encryption flag is not supported
|
||||
qemu-img: Error while amending options: Operation not supported
|
||||
qemu-img: Cannot change preallocation mode
|
||||
qemu-img: Error while amending options: Operation not supported
|
||||
|
||||
=== Testing correct handling of unset value ===
|
||||
|
||||
|
@ -377,7 +371,6 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
|
|||
Should work:
|
||||
Should not work:
|
||||
qemu-img: Changing the cluster size is not supported
|
||||
qemu-img: Error while amending options: Operation not supported
|
||||
|
||||
=== Testing zero expansion on inactive clusters ===
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ wrote 512/512 bytes at offset 0
|
|||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid
|
||||
qemu-img: Snapshot L1 table offset invalid
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
qemu-img: Failed to turn zero into data clusters: Invalid argument
|
||||
Failed to flush the refcount block cache: Invalid argument
|
||||
write failed: Invalid argument
|
||||
qemu-img: Snapshot L1 table offset invalid
|
||||
|
@ -88,7 +88,7 @@ wrote 512/512 bytes at offset 0
|
|||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
qemu-img: Failed to load snapshot: Snapshot L1 table too large
|
||||
qemu-img: Snapshot L1 table too large
|
||||
qemu-img: Error while amending options: File too large
|
||||
qemu-img: Failed to turn zero into data clusters: File too large
|
||||
Failed to flush the refcount block cache: File too large
|
||||
write failed: File too large
|
||||
qemu-img: Snapshot L1 table too large
|
||||
|
|
|
@ -99,13 +99,11 @@ refcount bits: 64
|
|||
=== Amend to compat=0.10 ===
|
||||
|
||||
qemu-img: compat=0.10 requires refcount_bits=16
|
||||
qemu-img: Error while amending options: Operation not supported
|
||||
refcount bits: 64
|
||||
No errors were found on the image.
|
||||
refcount bits: 16
|
||||
refcount bits: 16
|
||||
qemu-img: Different refcount widths than 16 bits require compatibility level 1.1 or above (use compat=1.1 or greater)
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
qemu-img: Refcount widths other than 16 bits require compatibility level 1.1 or above (use compat=1.1 or greater)
|
||||
refcount bits: 16
|
||||
|
||||
=== Amend with snapshot ===
|
||||
|
@ -113,7 +111,6 @@ refcount bits: 16
|
|||
wrote 16777216/16777216 bytes at offset 0
|
||||
16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
qemu-img: Cannot decrease refcount entry width to 1 bits: Cluster at offset 0x50000 has a refcount of 2
|
||||
qemu-img: Error while amending options: Invalid argument
|
||||
No errors were found on the image.
|
||||
refcount bits: 16
|
||||
No errors were found on the image.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue