mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update disk-passthrough.sh
This commit is contained in:
parent
81952226bb
commit
cad39d4499
@ -172,17 +172,13 @@ while read -r DISK; do
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
USED_BY=""
|
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
|
||||||
|
|
||||||
# Buscar el disco por su ruta real y por su symlink /by-id (si lo tiene)
|
|
||||||
DISK_BYID=$(find /dev/disk/by-id/ -xtype l -exec bash -c 'readlink -f "$1"' _ {} \; | grep -F "$REAL_PATH" | head -n1)
|
|
||||||
|
|
||||||
CONFIG_DUMP=$(find /etc/pve/qemu-server /etc/pve/lxc -type f -exec cat {} + 2>/dev/null)
|
|
||||||
|
|
||||||
if grep -qF "$REAL_PATH" <<< "$CONFIG_DUMP" || [[ -n "$DISK_BYID" && "$CONFIG_DUMP" == *"$DISK_BYID"* ]]; then
|
|
||||||
USED_BY="[en uso]"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user