File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
scripts/vm/hypervisor/kvm Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,25 @@ backup_running_vm() {
171171 sleep 5
172172 done
173173
174+ # Use qemu-img convert to sparsify linstor backups which get bloated due to virsh backup-begin.
175+ name=" root"
176+ while read -r disk fullpath; do
177+ if [[ " $fullpath " != /dev/drbd/by-res/* ]]; then
178+ continue
179+ fi
180+ volUuid=$( get_linstor_uuid_from_path " $fullpath " )
181+ if ! qemu-img convert -O qcow2 " $dest /$name .$volUuid .qcow2" " $dest /$name .$volUuid .qcow2.tmp" > " $logFile " 2> >( cat >&2 ) ; then
182+ echo " qemu-img convert failed for $dest /$name .$volUuid .qcow2"
183+ cleanup
184+ exit 1
185+ fi
186+
187+ mv " $dest /$name .$volUuid .qcow2.tmp" " $dest /$name .$volUuid .qcow2"
188+ name=" datadisk"
189+ done < <(
190+ virsh -c qemu:///system domblklist " $VM " --details 2> /dev/null | awk ' $2=="disk"{print $3, $4}'
191+ )
192+
174193 rm -f $dest /backup.xml
175194 sync
176195
You can’t perform that action at this time.
0 commit comments