[libvirt-users] backup procedure using blockcopy

Eric Blake eblake at redhat.com
Tue Jul 2 13:42:20 UTC 2013


On 07/02/2013 06:55 AM, Thomas Stein wrote:
> 
>>   virsh dumpxml --security-info dom > dom.xml
>>   virsh undefine dom
> 
> Hello.
> 
> Someone was talking about this (undefining the VM) would not be
> neccessary anymore when qemu-1.5 has been released. Is that true?

Undefining the VM will not be necessary after two things happen:
1. qemu supports persistent bitmaps (which missed 1.5, and I'm not even
sure if Paolo plans on getting it in before 1.6)
2. libvirt has code added to use persistent bitmaps

so unfortunately, you'll still have to use undefining for a bit longer.

Meanwhile, qemu 1.6 is adding a new block-backup command that is nicer
than the current blockcopy (it does not require a persistent bitmap, and
takes the snapshot at the point in time where it is started, not where
it is ended); I'm also trying to figure out what API additions are
needed to libvirt to expose that capability as an alternative.

> 
>>   virsh blockcopy dom vda /path/to/backup-vda
>>   polling loop - check periodically until 'virsh blockjob dom vda'
>>   shows 100% completion
>>   virsh suspend dom
>>   virsh save dom /path/to/memory-backup --running
> 
> This does not work for me.
> 
> hn ~ # virsh blockjob gentoo-template vda
> Block Copy: [100 %]
> 
> hn ~ # virsh save gentoo-template
> /opt/virt-backup-blockcopy/gentoo-template/gentoo-template-memory-backup
> --running
> error: Failed to save domain gentoo-template to
> /opt/virt-backup-blockcopy/gentoo-template/gentoo-template-memory-backup
> error: Requested operation is not valid: domain has an active block job
> 
> Obviously i can not save while the blockjob is running.

Oh dear.  That's what I get for trying to write steps without actually
testing them :(

Try this modification (again untested, but at least doesn't have a block
job running during the save attempt):

   virsh dumpxml --security-info dom > dom.xml
   virsh undefine dom
   virsh blockcopy dom vda /path/to/backup-vda
   polling loop - check periodically until 'virsh blockjob dom vda'
     shows 100% completion
   virsh suspend dom
   virsh blockjob dom vda --abort
   virsh save dom /path/to/memory-backup --running
   virsh resume dom
   virsh define dom.xml

Basically, swap the 'blockjob --abort' and 'save' steps to take place in
the opposite order.  Since the guest is paused, there should be no
difference in the bits that get saved, and the swapped order should get
around the annoying code restrictions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130702/53a71f6e/attachment.sig>


More information about the libvirt-users mailing list