mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
qemu-img: Saner printing of large file sizes
Disk sizes close to INT64_MAX cause overflow, for some pretty ridiculous output: $ ./nbdkit -U - memory size=$((2**63 - 512)) --run 'qemu-img info $nbd' image: nbd+unix://?socket=/tmp/nbdkitHSAzNz/socket file format: raw virtual size: -8388607T (9223372036854775296 bytes) disk size: unavailable But there's no reason to have two separate implementations of integer to human-readable abbreviation, where one has overflow and stops at 'T', while the other avoids overflow and goes all the way to 'E'. With this patch, the output now claims 8EiB instead of -8388607T, which really is the correct rounding of largest file size supported by qemu (we could go 511 bytes larger if we used byte-accurate sizing instead of rounding up to the next sector boundary, but that wouldn't change the human-readable result). Quite a few iotests need updates to expected output to match. Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Tested-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
754da86714
commit
de38b5005e
29 changed files with 123 additions and 150 deletions
|
@ -16,7 +16,7 @@ can't open device TEST_DIR/t.vmdk: L1 size too big
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 2.0G (2147483648 bytes)
|
||||
virtual size: 2 GiB (2147483648 bytes)
|
||||
|
||||
=== Testing monolithicFlat with zeroed_grain ===
|
||||
qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain
|
||||
|
@ -26,8 +26,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicF
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat
|
||||
image: TEST_DIR/t.vmdk
|
||||
file format: vmdk
|
||||
virtual size: 1.0T (1073741824000 bytes)
|
||||
disk size: 16K
|
||||
virtual size: 0.977 TiB (1073741824000 bytes)
|
||||
disk size: 16 KiB
|
||||
Format specific information:
|
||||
cid: XXXXXXXX
|
||||
parent cid: XXXXXXXX
|
||||
|
@ -2055,7 +2055,7 @@ can't open: Cannot use relative extent paths with VMDK descriptor file 'json:{"i
|
|||
=== Testing version 3 ===
|
||||
image: TEST_DIR/iotest-version3.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 16G (17179869184 bytes)
|
||||
virtual size: 16 GiB (17179869184 bytes)
|
||||
cluster_size: 65536
|
||||
read 512/512 bytes at offset 0
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
|
@ -2262,7 +2262,7 @@ read 512/512 bytes at offset 64931328
|
|||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat
|
||||
image: TEST_DIR/t.IMGFMT
|
||||
file format: IMGFMT
|
||||
virtual size: 4.0T (4398046511104 bytes)
|
||||
virtual size: 4 TiB (4398046511104 bytes)
|
||||
wrote 512/512 bytes at offset 966367641600
|
||||
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
e100000000: 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ................
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue