Re: [libvirt-users] [Qemu-devel] About VM fork in QEMU

External snapshots (via the blockdev-snapshot-sync QMP command) can be taken in a matter of milliseconds if you only care about disk state. Furthermore, if you want to take a snapshot of both memory and disk state, such that the clone can be resumed from the same time, you can do that with a guest downtime that only lasts as long as the blockdev-snapshot-sync, by first doing a migrate to file then doing the disk snapshot when the VM pauses at the end of migration. Resuming the original guest is fast; resuming from the migration file is a bit longer, but it is still the fastest way possible to resume from a memory+disk snapshot. If you need anything faster, then yes, you would have to write patches to qemu to attempt cloning via fork() that makes sure to modify the active disk in use by the fork child so as not to interfere with the fork parent.
I think migrating memory to file then doing external disk snapshot is exactly what we want. Since we are using libvirt to manage different VMs, could you give us some specific guides (or references) that how we could migrate memory state to file using virsh interfaces and do external snapshots?
virsh snapshot-create-as $dom $name --live --memspec /path/to/memoryfile
I have tried this command on libvirt v1.1.3 and it returns "error: invalid argument: qemuDomainSnapshotCreateXML: unsupported flags (0x100)". Looks like --live is not supported yet. Could you let us know which version we should of libvirt we should use in order to use this feature? Thanks, Xinyang -- Xinyang GE Department of Computer Science & Engineering The Pennsylvania State University Homepage: http://www.cse.psu.edu/~xxg113/

[dropping qemu-devel] On 10/28/2013 11:30 AM, Xinyang Ge wrote:
virsh snapshot-create-as $dom $name --live --memspec /path/to/memoryfile
I have tried this command on libvirt v1.1.3 and it returns "error: invalid argument: qemuDomainSnapshotCreateXML: unsupported flags (0x100)". Looks like --live is not supported yet. Could you let us know which version we should of libvirt we should use in order to use this feature?
That's odd, because we have supported --live since 1.0.5. Are you sure you are running the right libvirtd version and not just reporting the version of your virsh? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

That's odd, because we have supported --live since 1.0.5. Are you sure you are running the right libvirtd version and not just reporting the version of your virsh?
You are right. I am running an old libvirtd but with a new virsh. It works now! Thank you so much! Xinyang -- Xinyang GE Department of Computer Science & Engineering The Pennsylvania State University Homepage: http://www.cse.psu.edu/~xxg113/

That's odd, because we have supported --live since 1.0.5. Are you sure you are running the right libvirtd version and not just reporting the version of your virsh?
You are right. I am running an old libvirtd but with a new virsh. It works now! Thank you so much!
Another question is about snapshot reversion. I am trying to use "virsh snapshot-revert $dom $snap" for snapshot reversion. However, it says nothing and returns almost immediately, but nothing happens to the guest. Do you know the reason? Xinyang -- Xinyang GE Department of Computer Science & Engineering The Pennsylvania State University Homepage: http://www.cse.psu.edu/~xxg113/

On 10/28/2013 12:12 PM, Xinyang Ge wrote:
That's odd, because we have supported --live since 1.0.5. Are you sure you are running the right libvirtd version and not just reporting the version of your virsh?
You are right. I am running an old libvirtd but with a new virsh. It works now! Thank you so much!
Another question is about snapshot reversion. I am trying to use "virsh snapshot-revert $dom $snap" for snapshot reversion. However, it says nothing and returns almost immediately, but nothing happens to the guest. Do you know the reason?
Libvirt does not yet support snapshot revert for external snapshots; there have been some ideas posted on list about what needs to be done to add the support, but so far no finalized patches. It's a bug that your attempts to revert are not being more vocal about failing due to lack of support. For now, you'll have to do the revert by manual use of qemu-img and editing of a libvirt <domain> XML; more details can be found on this wiki page (still in a bit of disarray, so feel free to edit it for clarity according to what works for you): http://wiki.libvirt.org/page/I_created_an_external_snapshot%2C_but_libvirt_w... -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Libvirt does not yet support snapshot revert for external snapshots; there have been some ideas posted on list about what needs to be done to add the support, but so far no finalized patches. It's a bug that your attempts to revert are not being more vocal about failing due to lack of support. For now, you'll have to do the revert by manual use of qemu-img and editing of a libvirt <domain> XML; more details can be found on this wiki page (still in a bit of disarray, so feel free to edit it for clarity according to what works for you):
I am not able to find a way to revert an external snapshot created by "virsh snapshot-create-as $dom $name --live --memspec /path/to/memoryfile" using qemu-img. Could you give us some specific instructions on how to revert an external snapshot manually? Xinyang -- Xinyang GE Department of Computer Science & Engineering The Pennsylvania State University Homepage: http://www.cse.psu.edu/~xxg113/
participants (2)
-
Eric Blake
-
Xinyang Ge