Update disk-passthrough.sh

This commit is contained in:
MacRimi 2025-04-08 09:42:10 +02:00 committed by GitHub
parent cad39d4499
commit 8842efc19b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,11 +173,17 @@ while read -r DISK; do
USED_BY=""
REAL_PATH=$(readlink -f "$DISK")
CONFIG_DATA=$(cat /etc/pve/qemu-server/*.conf /etc/pve/lxc/*.conf 2>/dev/null)
if grep -Fq "$DISK" <<< "$CONFIG_DATA"; then
USED_BY="[in use ct or vm]"
fi
for SYMLINK in /dev/disk/by-id/*; do
if [[ "$(readlink -f "$SYMLINK")" == "$REAL_PATH" ]]; then
if grep -Fq "$SYMLINK" <<< "$CONFIG_DATA"; then
USED_BY="[in use ct or vm]"
break
fi
fi
done