* [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list
@ 2024-01-23 5:03 Abhiram Tilak
2024-02-23 15:22 ` atp exp
2024-03-18 11:53 ` Kevin Wolf
0 siblings, 2 replies; 3+ messages in thread
From: Abhiram Tilak @ 2024-01-23 5:03 UTC (permalink / raw)
To: qemu-devel; +Cc: hreitz, kwolf, Abhiram Tilak
When running the command `qemu-img snapshot -l SNAPSHOT` the output of
VM_CLOCK (measures the offset between host and VM clock) cannot to
accommodate values in the order of thousands (4-digit).
This line [1] hints on the problem. Additionally, the column width for
the VM_CLOCK field was reduced from 15 to 13 spaces in commit b39847a5
in line [2], resulting in a shortage of space.
[1]:
https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L753
[2]:
https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L763
This patch restores the column width to 15 spaces and makes adjustments
to the affected iotests accordingly. Furthermore, addresses a potential
source
of confusion by removing whitespace in column headers. Example, VM CLOCK
is modified to VM_CLOCK. Additionally a '--' symbol is introduced when
ICOUNT returns no output for clarity.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2062
Fixes: b39847a50553 (migration: introduce icount field for snapshots )
Signed-off-by: Abhiram Tilak <atp.exp@gmail.com>
---
v4:
* Fit the column width within 80 characters by shrinking 'ID' field
* Add spaces between both fields and values for better spacing and
printing
v3:
* Make a patch by avoid changing the .patch file
v2:
* Change email provider to 'gmail' to avoid auto-wrapping patches
* Modify iotests for file 'qcow2-internal-snapshots.out'
block/qapi.c | 10 ++--
tests/qemu-iotests/176.out | 16 +++----
tests/qemu-iotests/267.out | 48 +++++++++----------
.../tests/qcow2-internal-snapshots.out | 14 +++---
4 files changed, 45 insertions(+), 43 deletions(-)
diff --git a/block/qapi.c b/block/qapi.c
index 9e806fa230..5f2182c406 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -742,15 +742,15 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
char *sizing = NULL;
if (!sn) {
- qemu_printf("%-10s%-17s%8s%20s%13s%11s",
- "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK", "ICOUNT");
+ qemu_printf("%-7s %-16s %8s %19s %15s %10s",
+ "ID", "TAG", "VM_SIZE", "DATE", "VM_CLOCK", "ICOUNT");
} else {
g_autoptr(GDateTime) date = g_date_time_new_from_unix_local(sn->date_sec);
g_autofree char *date_buf = g_date_time_format(date, "%Y-%m-%d %H:%M:%S");
secs = sn->vm_clock_nsec / 1000000000;
snprintf(clock_buf, sizeof(clock_buf),
- "%02d:%02d:%02d.%03d",
+ "%04d:%02d:%02d.%03d",
(int)(secs / 3600),
(int)((secs / 60) % 60),
(int)(secs % 60),
@@ -759,8 +759,10 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
if (sn->icount != -1ULL) {
snprintf(icount_buf, sizeof(icount_buf),
"%"PRId64, sn->icount);
+ } else {
+ snprintf(icount_buf, sizeof(icount_buf), "--");
}
- qemu_printf("%-9s %-16s %8s%20s%13s%11s",
+ qemu_printf("%-7s %-16s %8s %19s %15s %10s",
sn->id_str, sn->name,
sizing,
date_buf,
diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out
index 9d09b60452..dce1ca0446 100644
--- a/tests/qemu-iotests/176.out
+++ b/tests/qemu-iotests/176.out
@@ -37,8 +37,8 @@ Offset Length File
0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd
0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd
Snapshot list:
-ID TAG
-1 snap
+ID TAG
+1 snap
=== Test pass snapshot.1 ===
@@ -78,8 +78,8 @@ Offset Length File
0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
0x83400000 0x200 TEST_DIR/t.IMGFMT
Snapshot list:
-ID TAG
-1 snap
+ID TAG
+1 snap
=== Test pass snapshot.2 ===
@@ -119,8 +119,8 @@ Offset Length File
0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
0x83400000 0x200 TEST_DIR/t.IMGFMT
Snapshot list:
-ID TAG
-1 snap
+ID TAG
+1 snap
=== Test pass snapshot.3 ===
@@ -157,8 +157,8 @@ Offset Length File
0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
0x83400000 0x200 TEST_DIR/t.IMGFMT
Snapshot list:
-ID TAG
-1 snap
+ID TAG
+1 snap
=== Test pass bitmap.0 ===
diff --git a/tests/qemu-iotests/267.out b/tests/qemu-iotests/267.out
index 7176e376e1..f6f5d8715a 100644
--- a/tests/qemu-iotests/267.out
+++ b/tests/qemu-iotests/267.out
@@ -33,8 +33,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -44,8 +44,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -69,8 +69,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -94,8 +94,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -105,8 +105,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -119,8 +119,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -134,8 +134,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
@@ -145,15 +145,15 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
Internal snapshots on overlay:
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
Internal snapshots on backing file:
=== -blockdev with NBD server on the backing file ===
@@ -166,17 +166,17 @@ QEMU X.Y.Z monitor - type 'help' for more information
(qemu) savevm snap0
(qemu) info snapshots
List of snapshots present on all disks:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
--- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
(qemu) loadvm snap0
(qemu) quit
Internal snapshots on overlay:
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
Internal snapshots on backing file:
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
*** done
diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots.out b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
index 438f535e6a..fedb09224e 100644
--- a/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
+++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
@@ -14,8 +14,8 @@ wrote 524288/524288 bytes at offset 0
(qemu) quit
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
No errors were found on the image.
=== Verify that loading the snapshot reverts to the old content ===
@@ -47,9 +47,9 @@ read 64512/64512 bytes at offset 66560
(qemu) quit
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
-2 snap1 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
+2 snap1 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
No errors were found on the image.
=== qemu-img snapshot can revert to snapshots ===
@@ -79,8 +79,8 @@ read 64512/64512 bytes at offset 66560
(qemu) quit
Snapshot list:
-ID TAG VM SIZE DATE VM CLOCK ICOUNT
-1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
+ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
+1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
No errors were found on the image.
=== Error cases ===
--
2.42.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list
2024-01-23 5:03 [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list Abhiram Tilak
@ 2024-02-23 15:22 ` atp exp
2024-03-18 11:53 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: atp exp @ 2024-02-23 15:22 UTC (permalink / raw)
To: qemu-devel; +Cc: hreitz, kwolf
On Tue, 23 Jan 2024 at 10:34, Abhiram Tilak <atp.exp@gmail.com> wrote:
>
> When running the command `qemu-img snapshot -l SNAPSHOT` the output of
> VM_CLOCK (measures the offset between host and VM clock) cannot to
> accommodate values in the order of thousands (4-digit).
>
> This line [1] hints on the problem. Additionally, the column width for
> the VM_CLOCK field was reduced from 15 to 13 spaces in commit b39847a5
> in line [2], resulting in a shortage of space.
>
> [1]:
> https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L753
> [2]:
> https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L763
>
> This patch restores the column width to 15 spaces and makes adjustments
> to the affected iotests accordingly. Furthermore, addresses a potential
> source
> of confusion by removing whitespace in column headers. Example, VM CLOCK
> is modified to VM_CLOCK. Additionally a '--' symbol is introduced when
> ICOUNT returns no output for clarity.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2062
> Fixes: b39847a50553 (migration: introduce icount field for snapshots )
> Signed-off-by: Abhiram Tilak <atp.exp@gmail.com>
> ---
> v4:
> * Fit the column width within 80 characters by shrinking 'ID' field
> * Add spaces between both fields and values for better spacing and
> printing
> v3:
> * Make a patch by avoid changing the .patch file
> v2:
> * Change email provider to 'gmail' to avoid auto-wrapping patches
> * Modify iotests for file 'qcow2-internal-snapshots.out'
>
> block/qapi.c | 10 ++--
> tests/qemu-iotests/176.out | 16 +++----
> tests/qemu-iotests/267.out | 48 +++++++++----------
> .../tests/qcow2-internal-snapshots.out | 14 +++---
> 4 files changed, 45 insertions(+), 43 deletions(-)
>
> diff --git a/block/qapi.c b/block/qapi.c
> index 9e806fa230..5f2182c406 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -742,15 +742,15 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
> char *sizing = NULL;
>
> if (!sn) {
> - qemu_printf("%-10s%-17s%8s%20s%13s%11s",
> - "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK", "ICOUNT");
> + qemu_printf("%-7s %-16s %8s %19s %15s %10s",
> + "ID", "TAG", "VM_SIZE", "DATE", "VM_CLOCK", "ICOUNT");
> } else {
> g_autoptr(GDateTime) date = g_date_time_new_from_unix_local(sn->date_sec);
> g_autofree char *date_buf = g_date_time_format(date, "%Y-%m-%d %H:%M:%S");
>
> secs = sn->vm_clock_nsec / 1000000000;
> snprintf(clock_buf, sizeof(clock_buf),
> - "%02d:%02d:%02d.%03d",
> + "%04d:%02d:%02d.%03d",
> (int)(secs / 3600),
> (int)((secs / 60) % 60),
> (int)(secs % 60),
> @@ -759,8 +759,10 @@ void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
> if (sn->icount != -1ULL) {
> snprintf(icount_buf, sizeof(icount_buf),
> "%"PRId64, sn->icount);
> + } else {
> + snprintf(icount_buf, sizeof(icount_buf), "--");
> }
> - qemu_printf("%-9s %-16s %8s%20s%13s%11s",
> + qemu_printf("%-7s %-16s %8s %19s %15s %10s",
> sn->id_str, sn->name,
> sizing,
> date_buf,
> diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out
> index 9d09b60452..dce1ca0446 100644
> --- a/tests/qemu-iotests/176.out
> +++ b/tests/qemu-iotests/176.out
> @@ -37,8 +37,8 @@ Offset Length File
> 0x7ffe0000 0x20000 TEST_DIR/t.IMGFMT.itmd
> 0x83400000 0x200 TEST_DIR/t.IMGFMT.itmd
> Snapshot list:
> -ID TAG
> -1 snap
> +ID TAG
> +1 snap
>
> === Test pass snapshot.1 ===
>
> @@ -78,8 +78,8 @@ Offset Length File
> 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
> 0x83400000 0x200 TEST_DIR/t.IMGFMT
> Snapshot list:
> -ID TAG
> -1 snap
> +ID TAG
> +1 snap
>
> === Test pass snapshot.2 ===
>
> @@ -119,8 +119,8 @@ Offset Length File
> 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
> 0x83400000 0x200 TEST_DIR/t.IMGFMT
> Snapshot list:
> -ID TAG
> -1 snap
> +ID TAG
> +1 snap
>
> === Test pass snapshot.3 ===
>
> @@ -157,8 +157,8 @@ Offset Length File
> 0x7fff0000 0x10000 TEST_DIR/t.IMGFMT
> 0x83400000 0x200 TEST_DIR/t.IMGFMT
> Snapshot list:
> -ID TAG
> -1 snap
> +ID TAG
> +1 snap
>
> === Test pass bitmap.0 ===
>
> diff --git a/tests/qemu-iotests/267.out b/tests/qemu-iotests/267.out
> index 7176e376e1..f6f5d8715a 100644
> --- a/tests/qemu-iotests/267.out
> +++ b/tests/qemu-iotests/267.out
> @@ -33,8 +33,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -44,8 +44,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -69,8 +69,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -94,8 +94,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -105,8 +105,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -119,8 +119,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -134,8 +134,8 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> @@ -145,15 +145,15 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> Internal snapshots on overlay:
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> Internal snapshots on backing file:
>
> === -blockdev with NBD server on the backing file ===
> @@ -166,17 +166,17 @@ QEMU X.Y.Z monitor - type 'help' for more information
> (qemu) savevm snap0
> (qemu) info snapshots
> List of snapshots present on all disks:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> --- snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +-- snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> (qemu) loadvm snap0
> (qemu) quit
>
> Internal snapshots on overlay:
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> Internal snapshots on backing file:
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> *** done
> diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots.out b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
> index 438f535e6a..fedb09224e 100644
> --- a/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
> +++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
> @@ -14,8 +14,8 @@ wrote 524288/524288 bytes at offset 0
> (qemu) quit
>
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> No errors were found on the image.
>
> === Verify that loading the snapshot reverts to the old content ===
> @@ -47,9 +47,9 @@ read 64512/64512 bytes at offset 66560
> (qemu) quit
>
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> -2 snap1 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> +2 snap1 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> No errors were found on the image.
>
> === qemu-img snapshot can revert to snapshots ===
> @@ -79,8 +79,8 @@ read 64512/64512 bytes at offset 66560
> (qemu) quit
>
> Snapshot list:
> -ID TAG VM SIZE DATE VM CLOCK ICOUNT
> -1 snap0 SIZE yyyy-mm-dd hh:mm:ss 00:00:00.000
> +ID TAG VM_SIZE DATE VM_CLOCK ICOUNT
> +1 snap0 SIZE yyyy-mm-dd hh:mm:ss 0000:00:00.000 --
> No errors were found on the image.
>
> === Error cases ===
> --
> 2.42.1
>
ping
Abhiram,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list
2024-01-23 5:03 [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list Abhiram Tilak
2024-02-23 15:22 ` atp exp
@ 2024-03-18 11:53 ` Kevin Wolf
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2024-03-18 11:53 UTC (permalink / raw)
To: Abhiram Tilak; +Cc: qemu-devel, hreitz
Am 23.01.2024 um 06:03 hat Abhiram Tilak geschrieben:
> When running the command `qemu-img snapshot -l SNAPSHOT` the output of
> VM_CLOCK (measures the offset between host and VM clock) cannot to
> accommodate values in the order of thousands (4-digit).
>
> This line [1] hints on the problem. Additionally, the column width for
> the VM_CLOCK field was reduced from 15 to 13 spaces in commit b39847a5
> in line [2], resulting in a shortage of space.
>
> [1]:
> https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L753
> [2]:
> https://gitlab.com/qemu-project/qemu/-/blob/master/block/qapi.c?ref_type=heads#L763
>
> This patch restores the column width to 15 spaces and makes adjustments
> to the affected iotests accordingly. Furthermore, addresses a potential
> source
> of confusion by removing whitespace in column headers. Example, VM CLOCK
> is modified to VM_CLOCK. Additionally a '--' symbol is introduced when
> ICOUNT returns no output for clarity.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2062
> Fixes: b39847a50553 (migration: introduce icount field for snapshots )
> Signed-off-by: Abhiram Tilak <atp.exp@gmail.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-18 11:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 5:03 [PATCH v4] qemu-img: Fix Column Width and Improve Formatting in snapshot list Abhiram Tilak
2024-02-23 15:22 ` atp exp
2024-03-18 11:53 ` Kevin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).