Fix backup script removing image after unsuccessful pivot
If pivoting the VM backing storage back to the original image fails (e.g. VM being down at that time), the script currently still deletes the hotswap image, which means that all changes since the creation of the hotswap image are lost.
This commit is contained in:
parent
21de964e1b
commit
82a4af05ef
@ -22,8 +22,5 @@ borg create -v $REPOSITORY::$1_$(date +%F_%H-%M) \
|
||||
/var/lib/libvirt/images/$1.qcow2 \
|
||||
/root/backups/vm_meta/$1.xml
|
||||
|
||||
echo "Pivoting base image back to original"
|
||||
virsh blockcommit $1 vda --pivot --base=/var/lib/libvirt/images/$1.qcow2
|
||||
|
||||
echo "Removing snapshot image"
|
||||
rm /var/lib/libvirt/images/$1.hotswap.qcow2
|
||||
echo "Pivoting base image back to original, and removing the snapshot image"
|
||||
virsh blockcommit $1 vda --pivot --base=/var/lib/libvirt/images/$1.qcow2 && rm /var/lib/libvirt/images/$1.hotswap.qcow2
|
||||
|
Loading…
x
Reference in New Issue
Block a user