revised health checker

milliseconds, almost instant ...

fix for earlier pr which failed on new installs
if disk was not present #848
This commit is contained in:
Alex Genovese 2024-04-12 08:02:39 +02:00 committed by Martin Wimpress
parent 77123d0751
commit d030221214
1 changed files with 9 additions and 0 deletions

View File

@ -1770,6 +1770,15 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
exit 1 exit 1
fi fi
if [ -e "${disk_img}" ]; then
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
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}")")