[libvirt] offline migration / vm cloning with libvirt/virsh

Sethuraman Subbiah ssubbia2 at ncsu.edu
Sat Jul 2 20:13:23 UTC 2011

Hi ,

I am trying to perform offline migration (i.e) Create an incremental image
using the qcow format, transfer the vm memory state to a state fie.Use the
image and statefile together as a template. Now create a new vm using the
template. I can successfully do it using the following commands :

Save phase :


migrate "exec:gzip -c > STATEFILE.gz"


qemu-img create -b BASE_img -f qcow2 INCRE_img

Restore phase :

qemu-kvm -m 1024 -hda INCRE_img -incoming "exec: gzip -c -d STATEFILE.gz"

And it works fine. But I am not able to find the vm with virt-manager or
other libvirt based tools.

If I use :

virsh save <dom_id> STATEFILE

I can restore using "virsh restore STATEFILE" but I want to associate this
with the incremental image that I created, but I dont know how. I think it
saves the existing vm's xml file along with the STATEFILE, thus I am not
able to change the disk image to the incremental image.

Thus ,

1. Either I should find a way to make vms created using qemu-kvm appear in
libvirt-based tools.


2. Find a way to associate the virsh save STATEFILE with a incremental

Any help or hint with respect to these will be very helpful. I am try to do
cloning with minimal cost. This takes only 25 seconds ( to create STATEFILE)
and creating incremental image is instantatenous . But I want to use the vm
monitoring code based on libvirt. And it makes life difficult.

Thanks for your help.



Sethuraman Subbiah

Graduate Student - NC state University

M.S in Computer Science
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110702/325ebecc/attachment-0001.htm>

More information about the libvir-list mailing list