[libvirt-users] virsh blockcopy without undefine

Nathan Shearer mail at nathanshearer.ca
Wed Oct 14 05:09:41 UTC 2015

On 10/13/2015 09:59 PM, Eric Blake wrote:
> On 10/13/2015 09:46 PM, Nathan Shearer wrote:
>> I have a script that performs a backup with the following steps:
>>     virsh dumpxml --inactive "$DOMAIN" > "$TMP/${DOMAIN}.xml" && \
>>             virsh dumpxml --inactive "$DOMAIN" > "$DESTINATION_XML" && \
>>             virsh undefine "$DOMAIN" && \
>>             virsh blockcopy "$DOMAIN" "$SOURCE_DISK" "$DESTINATION_DISK"
>>     --wait --verbose --finish && \
>>             virsh define "$TMP/${DOMAIN}.xml"
>> It's basic and did work for creating basic backups. Is there a way to do
>> this without undefining the domain?
> Not yet. Qemu doesn't yet support persistent bitmaps; there is upstream
> work trying to add it, which might make qemu 2.5, and then libvirt has
> to be taught to use it.
>> I recently had to redefine the VM
>> from a backup XML because this script failed during the block copy step.
>> Why can't I blockcopy a domain that is defined? Why does it need to be
>> undefined first?
> Without a persistent bitmap, libvirt cannot restart a copy operation
> efficiently. Requiring the domain to be transient (via the
> undefine/define wrapper around the blockcopy) was a design decision made
> when blockcopy was first added to make the caller aware of the
> limitations, and put the caller in charge of what happens if the domain
> disappears in the middle of the operation.  We hope to lift that
> limitation when support for persistent bitmaps lands.
Okay, I'll just make my script a little more intelligent while I wait
for the newer versions. Definitely looking forward to qemu 2.5 and an
updated libvirt :)

More information about the libvirt-users mailing list