Am 02.07.13 15:42, schrieb Eric Blake:> 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.
Okay, understood.
>>
>>> 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
Much better but still a problem.
virsh suspend gentoo-template
Domain gentoo-template suspended
virsh blockjob gentoo-template vda --abort
virsh save gentoo-template
/opt/virt-backup-blockcopy/gentoo-template/gentoo-template-memory
Domain gentoo-template saved to
/opt/virt-backup-blockcopy/gentoo-template/gentoo-template-memory
virsh resume gentoo-template
error: failed to get domain 'gentoo-template'
error: Domain not found: no domain with matching name 'gentoo-template'
> 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.
I think i have to use "start" instead of "resume" although i
don't
understand this behaviour. Maybe i have to define the VM first? Is
"virsh save dom" shutting down the VM?
Thank you very much Eric.
t.