[libvirt] Notes: Non-shared storage live migration w/ active blockcommit

Kashyap Chamarthy kchamart at redhat.com
Fri Sep 26 23:24:09 UTC 2014


On Thu, Sep 25, 2014 at 07:56:09PM +0530, Kashyap Chamarthy wrote:
> This notes is based on an IRC conversation with Eric Blake, to have
> efficient non-shared storage live migration. Thought I'd post my notes
> here before I forget. Please review and spot if there are any
> inaccuracies.

Noting a couple of things I missed. . .

> Procedure
> ---------
> 
> (1) Starting from disk A, create a snapshot A <- A':
>         
>     $ virsh snapshot-create-as \
>         --domain f20vm snap1 snap1-desc \
>         --diskspec hda,file=/export/vmimages/A'.qcow2 \
>         --disk-only --atomic

Before performing a live blockcopy, make the domain transient (as
persistent dirty bitmap support is yet to arrive in QEMU).

Take backup of the guest XML:

    $ virsh dumpxml f20vm > /var/tmp/f20vm.xml

Undefine the running guest, thus turning it to a transient guest:

    $ virsh undefine f20vm

> (2) Background copy of A to B:
> 
>     $ virsh blockcopy \
>         --domain vm1 vda /export/vmimages/B.qcow2 \
>         --wait --verbose --shallow \
>         --finish
> 
> (3) Create an empty B' with backing file B:
> 
>     $ qemu-img create -f qcow2 -b B.qcow2 \
>         -o backing_fmt=qcow2 B'.qcow2
> 
>     [or]
> 
>     $ virsh vol-create-as default B'.qcow2 1G \
>         --format qcow2 \
>         --backing-vol B.qcow2 --backing-vol-format qcow2 
> 
> (4) Do a shallow blockcopy of A' to B':
> 
>     $ virsh blockcopy \
>         --domain vm1 vda /export/vmimages/B'.qcow2 \
>         --wait --verbose --shallow \
>         --finish

Since the a chain was already created in step (3), I should have used
'--reuse-external' flag at this shallow blockcopy.

> 
> (5) Then live shallow commit of B:
> 
>     $ virsh blockcommit \
>         --domain f20vm vda \
>         --wait --verbose --shallow \
>         --pivot --active --finish
>     Block Commit: [100 %]
>     Successfully pivoted
> 

--
/kashyap




More information about the libvir-list mailing list