Created
November 16, 2015 19:15
-
-
Save trapier/91c2887390a95c457bcb to your computer and use it in GitHub Desktop.
rsync based virsh migrate. minimal downtime and and avoids image bloating due to non-sparse copying.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VM=$1 | |
TARGET=$2 | |
vm_path=/var/lib/libvirt/images/$VM.img | |
rsync -vS --progress $vm_path root@$TARGET:$vm_path && \ | |
virsh migrate --live --suspend --persistent --undefinesource --verbose $VM qemu+ssh://$TARGET/system && \ | |
rsync -vS --progress $vm_image root@$TARGET:$vm_path && \ | |
virsh -c qemu+ssh://$TARGET/system resume $VM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment