qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1] hmp: 'info snapshots' not showing the id


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v1] hmp: 'info snapshots' not showing the id
Date: Fri, 15 Dec 2017 10:18:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 2017-12-13 05:50, seeteena wrote:
> Hi David,
> 
> While creating snapshots when tag name '0' used in the very first and 
> followed by tag name '1' then snapshot created with tag name '0' is getting 
> erased. 
> A snapshot is identified by a name computed either from an id, which is 
> basically a numerical counter starting at 1 for qcow2, or from a tag, which 
> is a string (provided
> by the user or automatically computed). 
> 
> (qemu) savevm 0
> 
> This creates a snapshot with tag '0' and id '1'.

That's something someone has complained about already, as far as I
remember, and this is indeed an issue.

>> (qemu) savevm 1
> 
> This deletes snapshot with name '1' (ie, with id '1') and creates snapshot 
> with tag '1' and id '1'.

I think this is the issue, not info snapshots.

> From the output of 'info snapshots' id '1' is not seen for tag '0' instead 
> seeing an empty field.
> 
> ID        TAG                 VM SIZE                DATE       VM CLOCK
> --        0                      338M 2017-10-16 13:44:35   00:02:07.491
> 
> If an ID shown as '1' in the above then user can understand the above 
> documented stuff i.e "If there is already a snapshot with the same tag or ID, 
> it is replaced".
> The '--' in ID field is annoying.

Maybe, but this patch is wrong still.  Commit 3a1ee711904 says exactly why:

> The patch uses snapshot name instead of snapshot id to determine whether a
> snapshot is fully available and uses '--' instead of snapshot id in output
> because the snapshot id is not guaranteed to be the same on all images.

info snapshots first shows a list of snapshots that are present on all
disks.  However, those are matched by name and not by ID, so the ID is
not necessarily the same.

Therefore, we can only print it if it is.  Sure, we can do that, but
your patch is missing that check.

Example:

$ qemu-img create -f qcow2 foo.qcow2 64M
Formatting 'foo.qcow2', fmt=qcow2 size=67108864 encryption=off
cluster_size=65536 lazy_refcounts=off refcount_bits=16
$ qemu-img create -f qcow2 bar.qcow2 64M
Formatting 'bar.qcow2', fmt=qcow2 size=67108864 encryption=off
cluster_size=65536 lazy_refcounts=off refcount_bits=16
$ qemu-img snapshot -c common_snapshot foo.qcow2
$ qemu-img snapshot -c bar_snapshot bar.qcow2
$ qemu-img snapshot -c common_snapshot bar.qcow2
$ qemu-system-x86_64 -hda foo.qcow2 -hdb bar.qcow2 -monitor stdio
$ qemu-img snapshot -l foo.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         common_snapshot           0 2017-12-15 10:09:17   00:00:00.000
$ qemu-img snapshot -l bar.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         bar_snapshot              0 2017-12-15 10:09:25   00:00:00.000
2         common_snapshot           0 2017-12-15 10:09:28   00:00:00.000
QEMU 2.9.1 monitor - type 'help' for more information
(qemu) info snapshots
List of snapshots present on all disks:
ID        TAG                 VM SIZE                DATE       VM CLOCK
--        common_snapshot           0 2017-12-15 10:09:17   00:00:00.000

List of partial (non-loadable) snapshots on 'ide0-hd1':
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         bar_snapshot              0 2017-12-15 10:09:25   00:00:00.000

With your patch:

(qemu) info snapshots
List of snapshots present on all disks:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         common_snapshot           0 2017-12-15 10:09:17   00:00:00.000

List of partial (non-loadable) snapshots on 'ide0-hd1':
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         bar_snapshot              0 2017-12-15 10:09:25   00:00:00.000

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]