Everything for the ultix-streaming (VM 5111, pfv-tsys5) performance pass: full report + host audit results, staged/gated configs, guest prep + host one-shot + post-reboot-fix + netcheck lifecycle scripts, grow-root manual runbook, rolling tracking HUD, questions v1, and the gateway boot-race hardening units. Applied and verified live 2026-08-31; open work is tracked in Redmine project 55 as #601-#607. [#602] 💘 Generated with Crush Assisted-by: Crush:glm-5.2
57 lines
2.0 KiB
Bash
Executable File
57 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# UKRRS Proxmox control wrapper for harness/human use. HARD RULES baked in:
|
|
# - vmids listed in PROTECTED are never touched (list THIS VM first).
|
|
# - graceful shutdown only; no reset, no hard stop, no bare down (house rule).
|
|
# Env:
|
|
# PVE_LOCAL=1 run ON the pve host itself (pvesh direct)
|
|
# or PVE_HOST + PVE_TOKEN remote, token format: user@realm!tokenid=secret
|
|
# PVE_NODE node name (required for vm ops)
|
|
# PROTECTED required, comma-separated vmids
|
|
# Usage:
|
|
# proxmox-ctl.sh vms
|
|
# proxmox-ctl.sh shutdown <vmid>
|
|
# proxmox-ctl.sh start <vmid>
|
|
# proxmox-ctl.sh snapshot <vmid> <name>
|
|
# Token setup (on the pve host, see REPORT.md appendix B):
|
|
# pveum user add ukrrs-infra@pam
|
|
# pveum user token add ukrrs-infra@pam harness -privsep 0 -expire 0
|
|
# pveum acl modify /pool/<preprod-pool> -user ukrrs-infra@pam -role PVEVMUser
|
|
set -euo pipefail
|
|
: "${PROTECTED:?set PROTECTED=vmid1,vmid2,... (this VM must be in the list)}"
|
|
|
|
pvesh_() {
|
|
if [ "${PVE_LOCAL:-0}" = 1 ]; then
|
|
command pvesh "$@"
|
|
else
|
|
: "${PVE_HOST:?}" "${PVE_TOKEN:?}"
|
|
command pvesh --host "$PVE_HOST" --api-token "$PVE_TOKEN" "$@"
|
|
fi
|
|
}
|
|
|
|
guard() {
|
|
case ",$PROTECTED," in
|
|
*",$1,"*) echo "REFUSED: vmid $1 is PROTECTED" >&2; exit 3 ;;
|
|
esac
|
|
}
|
|
|
|
cmd=${1:-}; shift || true
|
|
case "$cmd" in
|
|
vms)
|
|
pvesh_ get /cluster/resources --type vm ;;
|
|
shutdown)
|
|
[ $# = 1 ] || { echo "usage: $0 shutdown <vmid>" >&2; exit 2; }
|
|
guard "$1"; : "${PVE_NODE:?}"
|
|
pvesh_ create "/nodes/$PVE_NODE/qemu/$1/status/shutdown" --timeout 120 ;;
|
|
start)
|
|
[ $# = 1 ] || { echo "usage: $0 start <vmid>" >&2; exit 2; }
|
|
guard "$1"; : "${PVE_NODE:?}"
|
|
pvesh_ create "/nodes/$PVE_NODE/qemu/$1/status/start" ;;
|
|
snapshot)
|
|
[ $# = 2 ] || { echo "usage: $0 snapshot <vmid> <name>" >&2; exit 2; }
|
|
guard "$1"; : "${PVE_NODE:?}"
|
|
pvesh_ create "/nodes/$PVE_NODE/qemu/$1/snapshot" snapname="$2" ;;
|
|
*)
|
|
echo "usage: $0 vms|shutdown <vmid>|start <vmid>|snapshot <vmid> <name>" >&2
|
|
exit 2 ;;
|
|
esac
|