qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] vm internal snapshot deletes only delete first disk's s


From: Marcus
Subject: Re: [Qemu-devel] vm internal snapshot deletes only delete first disk's snapshots
Date: Tue, 14 Jul 2015 00:32:21 -0700

Ok, I seem to have fixed it. I can submit a patch, but some input would be appreciated. In savevm.c, we have two functions: 

void hmp_delvm(Monitor *mon, const QDict *qdict), which my libvirt is using

static int del_existing_snapshots(Monitor *mon, const char *name)


These look to have the same origins. My guess was that perhaps the hmp version was first, and the second was a copy for QMP, or perhaps vice versa. At any rate, I changed hmp_delvm to call del_existing_snapshots:

void hmp_delvm(Monitor *mon, const QDict *qdict)

{

    const char *name = qdict_get_str(qdict, "name");

    del_existing_snapshots(mon, name);

}

And the issue went away. My only concern with this is that hmp_delvm does a slightly different thing, it first calls find_vmstate_bs() which seems to check if the block devices support snapshots. del_existing_snapshots does this slightly differently. If I can get feedback on that I'd appreciate it. Also, I'll look around for patch submission guidelines, but if someone can point me in the right direction I'd appreciate it as well.

Thanks



On Mon, Jul 13, 2015 at 11:29 PM, Marcus <address@hidden> wrote:
Ok, this is weird. It looks like it dies on the first disk, which is the only one that actually gets its snapshot removed. Perhaps it is processing the first disk a second time?

# virsh qemu-monitor-command i-2-38-VM --hmp 'delvm 1'

Error while deleting snapshot on device 'virtio-disk0': Can't find the snapshot


On Mon, Jul 13, 2015 at 10:28 PM, Marcus <address@hidden> wrote:
Hi all,

    I've recently been toying with VM snapshots, and have ran into an issue. Given a VM with multiple disks, it seems a snapshot-create followed by a snapshot-delete will only remove the qcow2 snapshot for the first disk (or perhaps just the disk that contains the memory), not all of the disk snapshots it created. Is this something people are aware of? 

    In searching around, I found a bug report where snapshot-creates would fail due to the qcow2 snapshot ids being inconsistent. That looks like it is patched for 2.4 qemu (http://lists.nongnu.org/archive/html/qemu-devel/2015-03/msg04963.html), this bug would trigger that one by leaving IDs around that are inconsistent between member disks, but is not the same.

   At first I was snooping around the libvirt lists looking for an answer, but found in the code that they're simply calling the qemu monitor to handle snapshot deletes on active VMs.

# virsh snapshot-create 7

Domain snapshot 1436792720 created


# virsh snapshot-list 7

 Name                 Creation Time             State

------------------------------------------------------------

 1436792720           2015-07-13 06:05:20 -0700 running


# virsh domblklist 7

Target     Source

------------------------------------------------

vda        /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/e4d6e885-1382-40bc-890b-ad9c8b51a7a5

vdb        /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/7033e4c6-5f59-4325-b7e0-ae191e12e86c


# qemu-img snapshot -l  /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/e4d6e885-1382-40bc-890b-ad9c8b51a7a5

Snapshot list:

ID        TAG                 VM SIZE                DATE       VM CLOCK

1         1436792720             173M 2015-07-13 06:05:20   00:01:10.938


# qemu-img snapshot -l  /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/7033e4c6-5f59-4325-b7e0-ae191e12e86c

Snapshot list:

ID        TAG                 VM SIZE                DATE       VM CLOCK

1         1436792720                0 2015-07-13 06:05:20   00:01:10.938


# virsh snapshot-delete 7 1436792720

Domain snapshot 1436792720 deleted


# qemu-img snapshot -l  /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/e4d6e885-1382-40bc-890b-ad9c8b51a7a5

# qemu-img snapshot -l  /mnt/2a270ef3-f389-37a4-942f-380bed9f70aa/7033e4c6-5f59-4325-b7e0-ae191e12e86c

Snapshot list:

ID        TAG                 VM SIZE                DATE       VM CLOCK

1         1436792720                0 2015-07-13 06:05:20   00:01:10.938




reply via email to

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