[libvirt-users] Help with understanding and solving snapshot problem

Eric Blake eblake at redhat.com
Thu Apr 10 12:34:13 UTC 2014

On 04/10/2014 12:00 AM, rolf wrote:
> Hello
> Fairly new to libvirt.  I’m hoping to both solve a problem with this question as well as learn more detail about how libvirt works.

[Can you convince your mailer to wrap long lines?  It makes it easier
for other readers]

> Using RHEL 6.4 and libvirt version is 0.10.2 and qemu-img version is

Have you considered raising this as a support request with Red Hat?
From the upstream perspective, 0.10.2 is quite old, and Red Hat may be
better equipped to answer questions about what snapshot support they
have backported to that version of RHEL.  In particular, the fact that
you are not using RHEL 6.5 is a bit worrisome, and I also understand
that RHEL 6.x tends to not support internal snapshots.

> Using virt-manager I created a VM.  Nothing unusual as far as I can see.  I then added a disk. So I have a second virtio based volume which the guest then mounts as a separate filesystem.  At some stage after that I created a snapshot of the system.  
> I can’t delete the snapshot.   The end result is I’d like to create a snapshot that excludes the second (much larger) disk - that is backed up via conventional backup systems.  But the issue is first deleting the snapshot and my understanding of what its saying.
> So here is some basic info:
> # virsh snapshot-list host1
>  Name                 Creation Time             State
> ------------------------------------------------------------
>  snap1-host1           2014-01-19 16:59:10 +1100 shutoff
> # 
> # virsh snapshot-info host1 --current
> Name:           snap1-host1
> Domain:         host1
> Current:        yes
> State:          shutoff
> Location:       internal

So the fact that you created an internal snapshot may have already put
you in unsupported territory for the versions of software that you are
using.  That said, I can still try to help, and I hope that upstream
behaves nicer in this regards, although you have certainly given us
enough steps to try and reproduce if this is still a bug in upstream.
Or maybe the bug is here, and you really did create an external snapshot
but the code is reporting it incorrectly.  Can you post the actual
command that you used to create the snapshot?

> Parent:         -
> Children:       0
> Descendants:    0
> Metadata:       yes
> So I try and delete it:
> # virsh snapshot-delete host1 --current
> error: Failed to delete snapshot snap1-host1
> error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
> Why does it say “external” in the above error, when the snapshot-info says its Location is internal? Are they not related ideas?

It's very likely that you have tripped up on a bug, and perhaps on a bug
that has been fixed in the meantime in newer libvirt, which either needs
backporting to the RHEL version, or which Red Hat has deemed not worth
backporting because of their level of limited snapshot support in RHEL
6.  But again, going through a Red Hat support ticket will get faster
results than asking upstream.

> The img file /var/lib/libvirt/images/host1.img  is not being used by KVM.  the snapshot files are in use instead:
> # virsh domblklist host1
> Target     Source
> ------------------------------------------------
> vda        /var/lib/libvirt/snap1-host1.qcow2
> vdb        /var/lib/libvirt/snap1-host1-db.qcow2
> hdc        -
> Querying them:
> # qemu-img info /var/lib/libvirt/snap1-host1.qcow2 
> image: /var/lib/libvirt/snap1-host1.qcow2
> file format: qcow2
> virtual size: 24G (25769803776 bytes)
> disk size: 3.5G
> cluster_size: 65536

No external backing file listed; but I'm not sure how this relates to
the original snapshot.  Maybe you also want to show 'virsh
snapshot-dumpxml host1 snap1-host1' to make it more obvious what the
domain was using at the time you took the snapshot?

> [root at cocoa libvirt]# qemu-img info /var/lib/libvirt/snap1-host1-db.qcow2 
> image: /var/lib/libvirt/snap1-host1-db.qcow2
> file format: qcow2
> virtual size: 1.6T (1800279089664 bytes)
> disk size: 325G
> cluster_size: 65536
> What have I done wrong and how can I correct this so I can discard the existing snapshot and have a snapshot of the system excluding the second disk (and optionally which I can re-take at intervals and discard old ones)?

I don't quite have a full picture of how you got into the situation.  If
you are trying to just get rid of the snapshot, you could always try
'virsh snapshot-delete --metadata host1 snap1-host1', to make libvirt
forget about the snapshot without cleaning up any actual data (leaving
any external backing chains intact, and not removing internal snapshots
from qcow2 files).

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140410/874c0290/attachment.sig>

More information about the libvirt-users mailing list