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? 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?