download vms by torrent

This commit is contained in:
Raphael Dannecker 2023-07-04 10:43:57 +02:00
parent 354e1fb6fb
commit 4e5eebe367

View file

@ -50,12 +50,18 @@ upload_image() {
}
download_image() {
if [[ -f "/var/lib/libvirt/images/${VM_NAME}.qcow2.torrent" ]]; then
cd /var/lib/libvirt/images
ctorrent -e 0 "${VM_NAME}.qcow2.torrent"
/usr/local/bin/vmimage-torrent restart "${VM_NAME}.qcow2"
else
rsync -av --password-file=/etc/rsync.secret \
"rsync://vmuser@server:/vmimages-download/${VM_NAME}.qcow2" \
/var/lib/libvirt/images/
rsync -av --password-file=/etc/rsync.secret \
"rsync://vmuser@server:/vmimages-download/xml/${VM_NAME}.xml" \
/var/lib/libvirt/images/xml/
fi
}
sync_all_images() {
@ -72,7 +78,7 @@ sync_all_torrents() {
/var/lib/libvirt/images/
}
while getopts ':u:d:a:t' OPTION; do
while getopts ':u:d:at' OPTION; do
case "$OPTION" in
u)
VM_NAME=$OPTARG