pve admin tooling

This commit is contained in:
2025-08-02 16:49:43 +03:00
parent 898d733ebf
commit d4ebd93920
10 changed files with 254 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
#set -e
if ! which jq >> /dev/null; then
echo "jq not found"
exit 1
fi
#echo "USAGE: $0 [node (=hostname))]"
host="$HOSTNAME"
if [[ "$#" -ge 1 ]]; then
host="$1"
fi
function shutdown_ids {
pvesh get "/nodes/${host}/qemu" --output-format json |\
jq -r 'map(select( .status == "running" and (.tags | split(";") | any(.=="nomigrate")) ) | .vmid)[]'
}
shutdown_ids | while IFS= read -r vmid; do
pvesh create "/nodes/${host}/qemu/${vmid}/status/shutdown" -timeout 1 &
sleep 1
done
wait