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
d123a3dff1
commit
884f7dada5
@ -173,19 +173,10 @@ while read -r DISK; do
|
||||
|
||||
|
||||
|
||||
USED_BY=""
|
||||
while read -r ID NAME STATUS; do
|
||||
if [[ "$ID" =~ ^[0-9]+$ ]]; then
|
||||
if qm config "$ID" 2>/dev/null | grep -q "$DISK"; then
|
||||
USED_BY="vm $ID"
|
||||
break
|
||||
elif pct config "$ID" 2>/dev/null | grep -q "$DISK"; then
|
||||
USED_BY="ct $ID"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < <(pvesh get /nodes/$(hostname)/qemu --output-format=json | jq -r '.[] | "\(.vmid) \(.name) running"' ; \
|
||||
pvesh get /nodes/$(hostname)/lxc --output-format=json | jq -r '.[] | "\(.vmid) \(.name) running"')
|
||||
USED_BY=""
|
||||
if grep -q "$DISK" <(find /etc/pve/qemu-server /etc/pve/lxc -type f -exec cat {} +); then
|
||||
USED_BY="[in use ct or vm]"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@ -361,4 +352,4 @@ fi
|
||||
|
||||
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user