[libvirt-users] virsh blockcopy without undefine

Eric Blake eblake at redhat.com
Wed Oct 14 03:59:52 UTC 2015

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.

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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20151013/943f25da/attachment.sig>

More information about the libvirt-users mailing list