Procházet zdrojové kódy

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>
Eric Blake před 6 roky
rodič
revize
de38b5005e

+ 11 - 38
block/qapi.c

@@ -631,42 +631,13 @@ BlockStatsList *qmp_query_blockstats(bool has_query_nodes,
     return head;
     return head;
 }
 }
 
 
-#define NB_SUFFIXES 4
-
-static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
-{
-    static const char suffixes[NB_SUFFIXES] = {'K', 'M', 'G', 'T'};
-    int64_t base;
-    int i;
-
-    if (size <= 999) {
-        snprintf(buf, buf_size, "%" PRId64, size);
-    } else {
-        base = 1024;
-        for (i = 0; i < NB_SUFFIXES; i++) {
-            if (size < (10 * base)) {
-                snprintf(buf, buf_size, "%0.1f%c",
-                         (double)size / base,
-                         suffixes[i]);
-                break;
-            } else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) {
-                snprintf(buf, buf_size, "%" PRId64 "%c",
-                         ((size + (base >> 1)) / base),
-                         suffixes[i]);
-                break;
-            }
-            base = base * 1024;
-        }
-    }
-    return buf;
-}
-
 void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
 void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
 {
 {
-    char buf1[128], date_buf[128], clock_buf[128];
+    char date_buf[128], clock_buf[128];
     struct tm tm;
     struct tm tm;
     time_t ti;
     time_t ti;
     int64_t secs;
     int64_t secs;
+    char *sizing = NULL;
 
 
     if (!sn) {
     if (!sn) {
         qemu_printf("%-10s%-20s%7s%20s%15s",
         qemu_printf("%-10s%-20s%7s%20s%15s",
@@ -683,13 +654,14 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
                  (int)((secs / 60) % 60),
                  (int)((secs / 60) % 60),
                  (int)(secs % 60),
                  (int)(secs % 60),
                  (int)((sn->vm_clock_nsec / 1000000) % 1000));
                  (int)((sn->vm_clock_nsec / 1000000) % 1000));
+        sizing = size_to_str(sn->vm_state_size);
         qemu_printf("%-10s%-20s%7s%20s%15s",
         qemu_printf("%-10s%-20s%7s%20s%15s",
                     sn->id_str, sn->name,
                     sn->id_str, sn->name,
-                    get_human_readable_size(buf1, sizeof(buf1),
-                                            sn->vm_state_size),
+                    sizing,
                     date_buf,
                     date_buf,
                     clock_buf);
                     clock_buf);
     }
     }
+    g_free(sizing);
 }
 }
 
 
 static void dump_qdict(int indentation, QDict *dict);
 static void dump_qdict(int indentation, QDict *dict);
@@ -787,14 +759,13 @@ void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec)
 
 
 void bdrv_image_info_dump(ImageInfo *info)
 void bdrv_image_info_dump(ImageInfo *info)
 {
 {
-    char size_buf[128], dsize_buf[128];
+    char *size_buf, *dsize_buf;
     if (!info->has_actual_size) {
     if (!info->has_actual_size) {
-        snprintf(dsize_buf, sizeof(dsize_buf), "unavailable");
+        dsize_buf = g_strdup("unavailable");
     } else {
     } else {
-        get_human_readable_size(dsize_buf, sizeof(dsize_buf),
-                                info->actual_size);
+        dsize_buf = size_to_str(info->actual_size);
     }
     }
-    get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size);
+    size_buf = size_to_str(info->virtual_size);
     qemu_printf("image: %s\n"
     qemu_printf("image: %s\n"
                 "file format: %s\n"
                 "file format: %s\n"
                 "virtual size: %s (%" PRId64 " bytes)\n"
                 "virtual size: %s (%" PRId64 " bytes)\n"
@@ -802,6 +773,8 @@ void bdrv_image_info_dump(ImageInfo *info)
                 info->filename, info->format, size_buf,
                 info->filename, info->format, size_buf,
                 info->virtual_size,
                 info->virtual_size,
                 dsize_buf);
                 dsize_buf);
+    g_free(size_buf);
+    g_free(dsize_buf);
 
 
     if (info->has_encrypted && info->encrypted) {
     if (info->has_encrypted && info->encrypted) {
         qemu_printf("encrypted: yes\n");
         qemu_printf("encrypted: yes\n");

+ 3 - 3
tests/qemu-iotests/043.out

@@ -22,19 +22,19 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
 == finite chain of length 3 (human) ==
 == finite chain of length 3 (human) ==
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.2.base
 backing file: TEST_DIR/t.IMGFMT.2.base
 
 
 image: TEST_DIR/t.IMGFMT.2.base
 image: TEST_DIR/t.IMGFMT.2.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.1.base
 backing file: TEST_DIR/t.IMGFMT.1.base
 
 
 image: TEST_DIR/t.IMGFMT.1.base
 image: TEST_DIR/t.IMGFMT.1.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 
 
 == finite chain of length 3 (json) ==
 == finite chain of length 3 (json) ==

+ 1 - 1
tests/qemu-iotests/053.out

@@ -9,7 +9,7 @@ wrote 512/512 bytes at offset 0
 No errors were found on the image.
 No errors were found on the image.
 
 
 == Checking compressed image virtual disk size ==
 == Checking compressed image virtual disk size ==
-virtual size: 512 (512 bytes)
+virtual size: 512 B (512 bytes)
 
 
 == Verifying the compressed image ==
 == Verifying the compressed image ==
 read 512/512 bytes at offset 0
 read 512/512 bytes at offset 0

+ 5 - 5
tests/qemu-iotests/059.out

@@ -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
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 subformat=monolithicFlat
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 2.0G (2147483648 bytes)
+virtual size: 2 GiB (2147483648 bytes)
 
 
 === Testing monolithicFlat with zeroed_grain ===
 === Testing monolithicFlat with zeroed_grain ===
 qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable 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
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824000 subformat=twoGbMaxExtentFlat
 image: TEST_DIR/t.vmdk
 image: TEST_DIR/t.vmdk
 file format: 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:
 Format specific information:
     cid: XXXXXXXX
     cid: XXXXXXXX
     parent 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 ===
 === Testing version 3 ===
 image: TEST_DIR/iotest-version3.IMGFMT
 image: TEST_DIR/iotest-version3.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 16G (17179869184 bytes)
+virtual size: 16 GiB (17179869184 bytes)
 cluster_size: 65536
 cluster_size: 65536
 read 512/512 bytes at offset 0
 read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 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
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4.0T (4398046511104 bytes)
+virtual size: 4 TiB (4398046511104 bytes)
 wrote 512/512 bytes at offset 966367641600
 wrote 512/512 bytes at offset 966367641600
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 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  ................
 e100000000:  0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a  ................

+ 5 - 5
tests/qemu-iotests/060.out

@@ -13,7 +13,7 @@ write failed: Input/output error
 incompatible_features     0x2
 incompatible_features     0x2
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -364,10 +364,10 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 qcow2: Marking image as corrupt: Refblock at 0xffffff00000000 is not covered by the refcount structures; further corruption events will be suppressed
 qcow2: Marking image as corrupt: Refblock at 0xffffff00000000 is not covered by the refcount structures; further corruption events will be suppressed
 qemu-img: Failed to discard unused refblocks: Input/output error
 qemu-img: Failed to discard unused refblocks: Input/output error
 --- Checking and retrying ---
 --- Checking and retrying ---
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 No errors were found on the image.
 No errors were found on the image.
 Image resized.
 Image resized.
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 
 
 === Discarding a non-covered in-bounds refblock ===
 === Discarding a non-covered in-bounds refblock ===
 
 
@@ -375,10 +375,10 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 qcow2: Marking image as corrupt: Refblock at 0x1000000000 is not covered by the refcount structures; further corruption events will be suppressed
 qcow2: Marking image as corrupt: Refblock at 0x1000000000 is not covered by the refcount structures; further corruption events will be suppressed
 qemu-img: Failed to discard unused refblocks: Input/output error
 qemu-img: Failed to discard unused refblocks: Input/output error
 --- Checking and retrying ---
 --- Checking and retrying ---
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 No errors were found on the image.
 No errors were found on the image.
 Image resized.
 Image resized.
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 
 
 === Discarding a refblock covered by an unaligned refblock ===
 === Discarding a refblock covered by an unaligned refblock ===
 
 

+ 6 - 6
tests/qemu-iotests/061.out

@@ -495,7 +495,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM
 qemu-img: Cannot downgrade an image with a data file
 qemu-img: Cannot downgrade an image with a data file
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -515,7 +515,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IM
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'foo': No such file or directory
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Could not open 'foo': No such file or directory
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -528,7 +528,7 @@ Format specific information:
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': 'data-file' is required for this image
 qemu-img: Could not open 'TEST_DIR/t.IMGFMT': 'data-file' is required for this image
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -542,7 +542,7 @@ Format specific information:
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IMGFMT.data data_file_raw=on
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IMGFMT.data data_file_raw=on
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -554,7 +554,7 @@ Format specific information:
 No errors were found on the image.
 No errors were found on the image.
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -567,7 +567,7 @@ No errors were found on the image.
 qemu-img: data-file-raw cannot be set on existing images
 qemu-img: data-file-raw cannot be set on existing images
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1

+ 1 - 1
tests/qemu-iotests/070.out

@@ -22,6 +22,6 @@ read 18874368/18874368 bytes at offset 0
 === Verify image created by Disk2VHD can be opened ===
 === Verify image created by Disk2VHD can be opened ===
 image: TEST_DIR/test-disk2vhd.IMGFMT
 image: TEST_DIR/test-disk2vhd.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 256M (268435456 bytes)
+virtual size: 256 MiB (268435456 bytes)
 cluster_size: 2097152
 cluster_size: 2097152
 *** done
 *** done

+ 13 - 13
tests/qemu-iotests/082.out

@@ -6,14 +6,14 @@ Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_refcounts=off refcount_bits=16
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 
 
 Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M
 Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 128M
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=4096 lazy_refcounts=on refcount_bits=16
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 4096
 cluster_size: 4096
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -25,7 +25,7 @@ Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=on refcount_bits=16
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 8192
 cluster_size: 8192
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -37,7 +37,7 @@ Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 128
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16
 Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=8192 lazy_refcounts=off refcount_bits=16
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 8192
 cluster_size: 8192
 
 
 === create: help for -o ===
 === create: help for -o ===
@@ -278,18 +278,18 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 cluster_size=65536 lazy_
 Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: raw
 file format: raw
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 
 
 Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 Testing: convert -O foo -O qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 
 
 Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 4096
 cluster_size: 4096
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -300,7 +300,7 @@ Format specific information:
 Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 8192
 cluster_size: 8192
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -311,7 +311,7 @@ Format specific information:
 Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 8192
 cluster_size: 8192
 
 
 === convert: help for -o ===
 === convert: help for -o ===
@@ -560,7 +560,7 @@ qemu-img: Cannot enable copy offloading when -c is used
 Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2
 Testing: amend -f foo -f qcow2 -o lazy_refcounts=on TEST_DIR/t.qcow2
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -571,7 +571,7 @@ Format specific information:
 Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2
 Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 130M (136314880 bytes)
+virtual size: 130 MiB (136314880 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -582,7 +582,7 @@ Format specific information:
 Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2
 Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M TEST_DIR/t.qcow2
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 132M (138412032 bytes)
+virtual size: 132 MiB (138412032 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -593,7 +593,7 @@ Format specific information:
 Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2
 Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 148M (155189248 bytes)
+virtual size: 148 MiB (155189248 bytes)
 cluster_size: 65536
 cluster_size: 65536
 
 
 === amend: help for -o ===
 === amend: help for -o ===

+ 4 - 4
tests/qemu-iotests/084.out

@@ -5,7 +5,7 @@ QA output created by 084
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 disk image file size in bytes: 67109888
 disk image file size in bytes: 67109888
 
 
@@ -14,13 +14,13 @@ disk image file size in bytes: 67109888
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 disk image file size in bytes: 1024
 disk image file size in bytes: 1024
 Test 1: Maximum size (512 TB - 128 MB):
 Test 1: Maximum size (512 TB - 128 MB):
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 512T (562949819203584 bytes)
+virtual size: 512 TiB (562949819203584 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 Test 2: Size too large (512 TB - 128 MB + 64 kB)
 Test 2: Size too large (512 TB - 128 MB + 64 kB)
@@ -35,7 +35,7 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': unsupported VDI image (too many bl
 Test 5: Valid Image: 64MB, Blocks In Image 64, Block Size 1MB
 Test 5: Valid Image: 64MB, Blocks In Image 64, Block Size 1MB
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 Test 6: Block Size != 1MB; too small test (1MB - 1)
 Test 6: Block Size != 1MB; too small test (1MB - 1)

+ 1 - 1
tests/qemu-iotests/089.out

@@ -38,7 +38,7 @@ read failed: Input/output error
 
 
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 
 
 === Testing option merging ===
 === Testing option merging ===

+ 2 - 2
tests/qemu-iotests/095.out

@@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=104857600 backing_file=TEST_DIR/
 === Base image info before commit and resize ===
 === Base image info before commit and resize ===
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 5.0M (5242880 bytes)
+virtual size: 5 MiB (5242880 bytes)
 
 
 === Running QEMU Live Commit Test ===
 === Running QEMU Live Commit Test ===
 
 
@@ -23,5 +23,5 @@ virtual size: 5.0M (5242880 bytes)
 === Base image info after commit and resize ===
 === Base image info after commit and resize ===
 image: TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT.base
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 100M (104857600 bytes)
+virtual size: 100 MiB (104857600 bytes)
 *** done
 *** done

+ 3 - 3
tests/qemu-iotests/104.out

@@ -4,9 +4,9 @@ QA output created by 104
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1024
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0K (1024 bytes)
+virtual size: 1 KiB (1024 bytes)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1234
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.5K (1536 bytes)
-***done
+virtual size: 1.5 KiB (1536 bytes)
+*** done

+ 3 - 3
tests/qemu-iotests/110.out

@@ -6,14 +6,14 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.base
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 
 
 === Non-reconstructable filename ===
 === Non-reconstructable filename ===
 
 
 image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
 image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 
 
 === Backing name is always relative to the backed image ===
 === Backing name is always relative to the backed image ===
@@ -24,6 +24,6 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=t.IMGFMT.b
 
 
 image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-threshold": 1}}
 image: json:{"driver": "IMGFMT", "file": {"children": [{"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.copy"}], "driver": "quorum", "vote-threshold": 1}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: t.IMGFMT.base (cannot determine actual path)
 backing file: t.IMGFMT.base (cannot determine actual path)
 *** done
 *** done

+ 1 - 1
tests/qemu-iotests/114.out

@@ -3,7 +3,7 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.base
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: foo
 backing file format: foo

+ 2 - 2
tests/qemu-iotests/126.out

@@ -11,13 +11,13 @@ Formatting 'TEST_DIR/image:base.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=./image:base.IMGFMT
 Formatting 'TEST_DIR/image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=./image:base.IMGFMT
 image: TEST_DIR/image:top.IMGFMT
 image: TEST_DIR/image:top.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: ./image:base.IMGFMT (actual path: TEST_DIR/./image:base.IMGFMT)
 backing file: ./image:base.IMGFMT (actual path: TEST_DIR/./image:base.IMGFMT)
 
 
 Formatting 'base.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'base.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'file:image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=base.IMGFMT
 Formatting 'file:image:top.IMGFMT', fmt=IMGFMT size=67108864 backing_file=base.IMGFMT
 image: ./image:top.IMGFMT
 image: ./image:top.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: base.IMGFMT (actual path: ./base.IMGFMT)
 backing file: base.IMGFMT (actual path: ./base.IMGFMT)
 *** done
 *** done

+ 5 - 5
tests/qemu-iotests/130.out

@@ -4,7 +4,7 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 
 
 === HMP commit ===
 === HMP commit ===
 
 
@@ -13,14 +13,14 @@ QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) 
 (qemu) 
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
 QEMU X.Y.Z monitor - type 'help' for more information
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) commit testdisk
 (qemu) commit testdisk
 (qemu) 
 (qemu) 
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: TEST_DIR/t.IMGFMT.orig
 backing file: TEST_DIR/t.IMGFMT.orig
 backing file format: raw
 backing file format: raw
 
 
@@ -31,13 +31,13 @@ wrote 4096/4096 bytes at offset 0
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw
 wrote 4096/4096 bytes at offset 0
 wrote 4096/4096 bytes at offset 0
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 backing file: TEST_DIR/t.IMGFMT.orig
 backing file: TEST_DIR/t.IMGFMT.orig
 backing file format: raw
 backing file format: raw
 *** done
 *** done

+ 1 - 1
tests/qemu-iotests/153.out

@@ -449,7 +449,7 @@ _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512
 No conflict:
 No conflict:
 image: null-co://
 image: null-co://
 file format: null-co
 file format: null-co
-virtual size: 1.0G (1073741824 bytes)
+virtual size: 1 GiB (1073741824 bytes)
 disk size: unavailable
 disk size: unavailable
 
 
 Conflict:
 Conflict:

+ 4 - 4
tests/qemu-iotests/191.out

@@ -395,13 +395,13 @@ wrote 65536/65536 bytes at offset 1048576
 }
 }
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: IMGFMT
 backing file format: IMGFMT
 image: TEST_DIR/t.IMGFMT.ovl2
 image: TEST_DIR/t.IMGFMT.ovl2
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: IMGFMT
 backing file format: IMGFMT
@@ -813,13 +813,13 @@ wrote 65536/65536 bytes at offset 1048576
 }
 }
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: IMGFMT
 backing file format: IMGFMT
 image: TEST_DIR/t.IMGFMT.ovl2
 image: TEST_DIR/t.IMGFMT.ovl2
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 backing file format: IMGFMT
 backing file format: IMGFMT

+ 2 - 2
tests/qemu-iotests/195.out

@@ -35,7 +35,7 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
 
 
 image: TEST_DIR/t.IMGFMT.mid
 image: TEST_DIR/t.IMGFMT.mid
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: /dev/null
 backing file: /dev/null
 backing file format: IMGFMT
 backing file format: IMGFMT
@@ -73,7 +73,7 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
 
 
 image: TEST_DIR/t.IMGFMT
 image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 backing file: /dev/null
 backing file: /dev/null
 backing file format: IMGFMT
 backing file format: IMGFMT

+ 2 - 2
tests/qemu-iotests/198.out

@@ -34,7 +34,7 @@ read 16777216/16777216 bytes at offset 0
 == checking image base ==
 == checking image base ==
 image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}}
 image: json:{"encrypt.key-secret": "sec0", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.base"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 16M (16777216 bytes)
+virtual size: 16 MiB (16777216 bytes)
 Format specific information:
 Format specific information:
     encrypt:
     encrypt:
         ivgen alg: plain64
         ivgen alg: plain64
@@ -76,7 +76,7 @@ Format specific information:
 == checking image layer ==
 == checking image layer ==
 image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}
 image: json:{"encrypt.key-secret": "sec1", "driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 16M (16777216 bytes)
+virtual size: 16 MiB (16777216 bytes)
 backing file: TEST_DIR/t.IMGFMT.base
 backing file: TEST_DIR/t.IMGFMT.base
 Format specific information:
 Format specific information:
     encrypt:
     encrypt:

+ 5 - 5
tests/qemu-iotests/206.out

@@ -14,7 +14,7 @@
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -36,7 +36,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -58,7 +58,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 cluster_size: 2097152
 cluster_size: 2097152
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -80,7 +80,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 cluster_size: 512
 cluster_size: 512
 backing file: TEST_IMG.base
 backing file: TEST_IMG.base
 backing file format: IMGFMT
 backing file format: IMGFMT
@@ -97,7 +97,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 encrypted: yes
 encrypted: yes
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:

+ 6 - 6
tests/qemu-iotests/207.out

@@ -7,12 +7,12 @@
 
 
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4.0M (4194304 bytes)
+virtual size: 4 MiB (4194304 bytes)
 
 
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4.0M (4194304 bytes)
+virtual size: 4 MiB (4194304 bytes)
 
 
 === Test host-key-check options ===
 === Test host-key-check options ===
 
 
@@ -23,7 +23,7 @@ virtual size: 4.0M (4194304 bytes)
 
 
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 8.0M (8388608 bytes)
+virtual size: 8 MiB (8388608 bytes)
 
 
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"mode": "known_hosts"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 4194304}}}
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"mode": "known_hosts"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 4194304}}}
 {"return": {}}
 {"return": {}}
@@ -32,7 +32,7 @@ virtual size: 8.0M (8388608 bytes)
 
 
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4.0M (4194304 bytes)
+virtual size: 4 MiB (4194304 bytes)
 
 
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "md5"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}}
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "md5"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}}
 {"return": {}}
 {"return": {}}
@@ -47,7 +47,7 @@ Job failed: remote host key does not match host_key_check 'wrong'
 
 
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 8.0M (8388608 bytes)
+virtual size: 8 MiB (8388608 bytes)
 
 
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "sha1"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}}
 {"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "ssh", "location": {"host-key-check": {"hash": "wrong", "mode": "hash", "type": "sha1"}, "path": "TEST_DIR/PID-t.img", "server": {"host": "127.0.0.1", "port": "22"}}, "size": 2097152}}}
 {"return": {}}
 {"return": {}}
@@ -62,7 +62,7 @@ Job failed: remote host key does not match host_key_check 'wrong'
 
 
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4.0M (4194304 bytes)
+virtual size: 4 MiB (4194304 bytes)
 
 
 === Invalid path and user ===
 === Invalid path and user ===
 
 

+ 4 - 4
tests/qemu-iotests/210.out

@@ -14,7 +14,7 @@
 
 
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 encrypted: yes
 encrypted: yes
 Format specific information:
 Format specific information:
     ivgen alg: plain64
     ivgen alg: plain64
@@ -66,7 +66,7 @@ Format specific information:
 
 
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 encrypted: yes
 encrypted: yes
 Format specific information:
 Format specific information:
     ivgen alg: plain64
     ivgen alg: plain64
@@ -121,7 +121,7 @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi
 
 
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 0 (0 bytes)
+virtual size: 0 B (0 bytes)
 encrypted: yes
 encrypted: yes
 Format specific information:
 Format specific information:
     ivgen alg: plain64
     ivgen alg: plain64
@@ -191,7 +191,7 @@ Job failed: The requested file size is too large
 {"error": {"class": "GenericError", "desc": "Parameter 'size' expects a >0 size"}}
 {"error": {"class": "GenericError", "desc": "Parameter 'size' expects a >0 size"}}
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "TEST_IMG"}, "key-secret": "keysec0"}
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 0 (0 bytes)
+virtual size: 0 B (0 bytes)
 encrypted: yes
 encrypted: yes
 Format specific information:
 Format specific information:
     ivgen alg: plain64
     ivgen alg: plain64

+ 5 - 5
tests/qemu-iotests/211.out

@@ -14,7 +14,7 @@
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 [{ "start": 0, "length": 134217728, "depth": 0, "zero": true, "data": false}]
 [{ "start": 0, "length": 134217728, "depth": 0, "zero": true, "data": false}]
@@ -33,7 +33,7 @@ cluster_size: 1048576
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 [{ "start": 0, "length": 67108864, "depth": 0, "zero": true, "data": false}]
 [{ "start": 0, "length": 67108864, "depth": 0, "zero": true, "data": false}]
@@ -52,7 +52,7 @@ cluster_size: 1048576
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 [{ "start": 0, "length": 3072, "depth": 0, "zero": false, "data": true, "offset": 1024},
 [{ "start": 0, "length": 3072, "depth": 0, "zero": false, "data": true, "offset": 1024},
@@ -75,7 +75,7 @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 0 (0 bytes)
+virtual size: 0 B (0 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 === Maximum size ===
 === Maximum size ===
@@ -87,7 +87,7 @@ cluster_size: 1048576
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 512T (562949819203584 bytes)
+virtual size: 512 TiB (562949819203584 bytes)
 cluster_size: 1048576
 cluster_size: 1048576
 
 
 === Invalid sizes ===
 === Invalid sizes ===

+ 5 - 5
tests/qemu-iotests/212.out

@@ -14,7 +14,7 @@
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 
 
 === Successful image creation (explicit defaults) ===
 === Successful image creation (explicit defaults) ===
 
 
@@ -30,7 +30,7 @@ virtual size: 128M (134217728 bytes)
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 
 
 === Successful image creation (with non-default options) ===
 === Successful image creation (with non-default options) ===
 
 
@@ -46,7 +46,7 @@ virtual size: 64M (67108864 bytes)
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 
 
 === Invalid BlockdevRef ===
 === Invalid BlockdevRef ===
 
 
@@ -65,7 +65,7 @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 0 (0 bytes)
+virtual size: 0 B (0 bytes)
 
 
 === Maximum size ===
 === Maximum size ===
 
 
@@ -76,7 +76,7 @@ virtual size: 0 (0 bytes)
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 4096T (4503599627369984 bytes)
+virtual size: 4 PiB (4503599627369984 bytes)
 
 
 === Invalid sizes ===
 === Invalid sizes ===
 
 

+ 5 - 5
tests/qemu-iotests/213.out

@@ -14,7 +14,7 @@
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 128M (134217728 bytes)
+virtual size: 128 MiB (134217728 bytes)
 cluster_size: 8388608
 cluster_size: 8388608
 
 
 === Successful image creation (explicit defaults) ===
 === Successful image creation (explicit defaults) ===
@@ -31,7 +31,7 @@ cluster_size: 8388608
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 8388608
 cluster_size: 8388608
 
 
 === Successful image creation (with non-default options) ===
 === Successful image creation (with non-default options) ===
@@ -48,7 +48,7 @@ cluster_size: 8388608
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 cluster_size: 268435456
 cluster_size: 268435456
 
 
 === Invalid BlockdevRef ===
 === Invalid BlockdevRef ===
@@ -68,7 +68,7 @@ Job failed: Cannot find device=this doesn't exist nor node_name=this doesn't exi
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 0 (0 bytes)
+virtual size: 0 B (0 bytes)
 cluster_size: 8388608
 cluster_size: 8388608
 
 
 === Maximum size ===
 === Maximum size ===
@@ -80,7 +80,7 @@ cluster_size: 8388608
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64T (70368744177664 bytes)
+virtual size: 64 TiB (70368744177664 bytes)
 cluster_size: 67108864
 cluster_size: 67108864
 
 
 === Invalid sizes ===
 === Invalid sizes ===

+ 2 - 2
tests/qemu-iotests/233.out

@@ -28,11 +28,11 @@ server reported: Option 0x8 not permitted before TLS
 == check TLS works ==
 == check TLS works ==
 image: nbd://127.0.0.1:PORT
 image: nbd://127.0.0.1:PORT
 file format: nbd
 file format: nbd
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 disk size: unavailable
 disk size: unavailable
 image: nbd://127.0.0.1:PORT
 image: nbd://127.0.0.1:PORT
 file format: nbd
 file format: nbd
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 disk size: unavailable
 disk size: unavailable
 exports available: 1
 exports available: 1
  export: ''
  export: ''

+ 11 - 11
tests/qemu-iotests/237.out

@@ -14,7 +14,7 @@
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 5.0G (5368709120 bytes)
+virtual size: 5 GiB (5368709120 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -41,7 +41,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 64M (67108864 bytes)
+virtual size: 64 MiB (67108864 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -68,7 +68,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 32M (33554432 bytes)
+virtual size: 32 MiB (33554432 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -169,7 +169,7 @@ Job failed: List of extents contains unused extents
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 512 (512 bytes)
+virtual size: 512 B (512 bytes)
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
@@ -189,7 +189,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 512 (512 bytes)
+virtual size: 512 B (512 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -211,7 +211,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0G (1073741824 bytes)
+virtual size: 1 GiB (1073741824 bytes)
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
@@ -231,7 +231,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0G (1073741824 bytes)
+virtual size: 1 GiB (1073741824 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -253,7 +253,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 2.0G (2147483648 bytes)
+virtual size: 2 GiB (2147483648 bytes)
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
@@ -273,7 +273,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 2.0G (2147483648 bytes)
+virtual size: 2 GiB (2147483648 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
@@ -295,7 +295,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 5.0G (5368709120 bytes)
+virtual size: 5 GiB (5368709120 bytes)
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
     parent cid: XXXXXXXXXX
@@ -323,7 +323,7 @@ Format specific information:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 5.0G (5368709120 bytes)
+virtual size: 5 GiB (5368709120 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     cid: XXXXXXXXXX
     cid: XXXXXXXXXX

+ 5 - 5
tests/qemu-iotests/242.out

@@ -8,7 +8,7 @@ qemu-img info dump:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0M (1048576 bytes)
+virtual size: 1 MiB (1048576 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -28,7 +28,7 @@ qemu-img info dump:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0M (1048576 bytes)
+virtual size: 1 MiB (1048576 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -60,7 +60,7 @@ qemu-img info dump:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0M (1048576 bytes)
+virtual size: 1 MiB (1048576 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -100,7 +100,7 @@ qemu-img info dump:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0M (1048576 bytes)
+virtual size: 1 MiB (1048576 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1
@@ -149,7 +149,7 @@ Unset the unknown bitmap flag '0x4' in the bitmap directory entry:
 
 
 image: TEST_IMG
 image: TEST_IMG
 file format: IMGFMT
 file format: IMGFMT
-virtual size: 1.0M (1048576 bytes)
+virtual size: 1 MiB (1048576 bytes)
 cluster_size: 65536
 cluster_size: 65536
 Format specific information:
 Format specific information:
     compat: 1.1
     compat: 1.1