[Openstack] Libvirt Snapshots

Daniel P. Berrange berrange at redhat.com
Fri Mar 9 08:18:29 UTC 2012


On Thu, Mar 08, 2012 at 06:02:54PM -0800, Vishvananda Ishaya wrote:
> So I could use some specific feedback from kvm/libvirt folks on the following questions:
> 
> a) is it safe to use qemu-img to create/delete a snapshot in a disk file that libvirt is writing to.
> if not:
> b) is it safe to use qemu-img to delete a snapshot in a disk file that libvirt is writing to but not actively using.
> if not:
> c) is it safe to use qemu-img to create/delete a snapshot in a disk file that libvirt has an open file handle to.

Sadly, the answer is no to all those questions. For Qcow2 files, using
internal snapshots, you cannot make *any* changes to the qcow2 file,
while QEMU has it open. The reasons are that QEMU may have metadata
changes pending to the file which have not yet flushed to disk, and
second, creating/deleteing the snapshot with qemu-img may cause
metadat changes that QEMU won't be aware of. Either way you will likely
cause corruption of the qcow2 file.

For these reasons, QEMU provides monitor commands for snapshotting,
that libvirt uses whenever the guest is running. Libvirt will only
use qemu-img, if the the guest is offline.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Openstack mailing list