[libvirt] kvm savevm/loadvm

Hi, virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it? thanks, -serge

On Tue, Jul 20, 2010 at 05:17:43AM -0500, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
This is included in the 'snapshot' APIs / virsh commands as of 0.8.1 libvirt release Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Quoting Daniel P. Berrange (berrange@redhat.com):
On Tue, Jul 20, 2010 at 05:17:43AM -0500, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
This is included in the 'snapshot' APIs / virsh commands as of 0.8.1 libvirt release
Oh, excellent! (Alas, my libvirt 0.8.1 doesn't seem to think that my qcow2 images can support snapshots, but I"ll have to look into that some more) thanks, -serge

On 07/20/2010 04:24 PM, Serge Hallyn wrote:
Quoting Daniel P. Berrange (berrange@redhat.com):
On Tue, Jul 20, 2010 at 05:17:43AM -0500, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
This is included in the 'snapshot' APIs / virsh commands as of 0.8.1 libvirt release
Oh, excellent! (Alas, my libvirt 0.8.1 doesn't seem to think that my qcow2 images can support snapshots, but I"ll have to look into that some more)
You will need to set the driver type <driver name='qemu' type='qcow2'/> example: <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writethrough'/> <source file='/var/lib/vm/data/images/debian.img'/> <target dev='vda' bus='virtio'/> </disk> Regards, Jason

Quoting Jason Krieg (jason.krieg@collax.com):
On 07/20/2010 04:24 PM, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it? This is included in the 'snapshot' APIs / virsh commands as of 0.8.1
On Tue, Jul 20, 2010 at 05:17:43AM -0500, Serge Hallyn wrote: libvirt release Oh, excellent! (Alas, my libvirt 0.8.1 doesn't seem to think that my qcow2 images can support snapshots, but I"ll have to look into
Quoting Daniel P. Berrange (berrange@redhat.com): that some more)
You will need to set the driver type <driver name='qemu' type='qcow2'/>
example:
<disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='writethrough'/> <source file='/var/lib/vm/data/images/debian.img'/> <target dev='vda' bus='virtio'/> </disk>
Regards, Jason
Thanks! That worked beautifully. Well, interestingly, the first time I made this change, the '<driver name=' line got cut off so the type and cache options were gone, but once it let those stick, it worked great. thanks! -serge

On 07/20/10 - 05:17:43AM, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
The save/restore API only does a memory snapshot. If you are referring to the savevm/loadvm/delvm, which take a disk+memory snapshot, then that is implemented in terms of the libvirt snapshot API. You can start here: http://libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotCreateXML -- Chris Lalancette

Quoting Chris Lalancette (clalance@redhat.com):
On 07/20/10 - 05:17:43AM, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
The save/restore API only does a memory snapshot. If you are referring
Jinkeys, I guess so - my first tests were confounded by the page cache being reverted and then synced back to disk :)
to the savevm/loadvm/delvm, which take a disk+memory snapshot, then that is implemented in terms of the libvirt snapshot API. You can start here:
http://libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotCreateXML
Ok, so the snapshot created by virDomainSnapshotCreateXML is not what is used by 'virsh snapshot-create'? Are there any plans of exporting this through virsh? thanks, -serge

On 07/22/10 - 10:40:44AM, Serge Hallyn wrote:
Quoting Chris Lalancette (clalance@redhat.com):
On 07/20/10 - 05:17:43AM, Serge Hallyn wrote:
Hi,
virsh has save/restore to do a one-time save+shutdown. But it does not expose kvm's savevm/restorevm, which let's me do incremental snapshots. Is there a specific reason why that is not exposed in libvirt, or is it just that noone has implemented it?
The save/restore API only does a memory snapshot. If you are referring
Jinkeys, I guess so - my first tests were confounded by the page cache being reverted and then synced back to disk :)
to the savevm/loadvm/delvm, which take a disk+memory snapshot, then that is implemented in terms of the libvirt snapshot API. You can start here:
http://libvirt.org/html/libvirt-libvirt.html#virDomainSnapshotCreateXML
Ok, so the snapshot created by virDomainSnapshotCreateXML is not what is used by 'virsh snapshot-create'? Are there any plans of exporting this through virsh?
No, these two things are the same; virsh snapshot-create calls virDomainSnapshotCreateXML (which eventually calls savevm in the qemu monitor). -- Chris Lalancette
participants (4)
-
Chris Lalancette
-
Daniel P. Berrange
-
Jason Krieg
-
Serge Hallyn