add disk health check

This commit is contained in:
Alex Genovese 2023-12-22 11:04:00 +01:00 committed by Martin Wimpress
parent 286ac1bcfe
commit 59865c894e
1 changed files with 8 additions and 0 deletions

View File

@ -1749,6 +1749,14 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
exit 1 exit 1
fi fi
DiskChkMsg="$("$QEMU_IMG" check -q "${disk_img}" 2>&1)"
if [[ $DiskChkMsg ]]; then
echo; echo "ERROR! disk.qcow2 has problems. Try qemu-img check --help."
echo; echo "$DiskChkMsg" ; echo
exit 1
fi
VMDIR=$(dirname "${disk_img}") VMDIR=$(dirname "${disk_img}")
VMNAME=$(basename "${VM}" .conf) VMNAME=$(basename "${VM}" .conf)
VMPATH=$(realpath "$(dirname "${VM}")") VMPATH=$(realpath "$(dirname "${VM}")")