chore: initial import from KNEL/PFVCluster@041d311 [#769]

Split per O&M lane work order. Full history: KNEL/PFVCluster.
https://projects.knownelement.com/issues/769#note-4152
This commit is contained in:
2026-09-03 21:39:35 -05:00
commit 7a899b8ac6
67 changed files with 7166 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# lxc-bench-setup.sh — run ON a Proxmox host: stand up the #709 bench LXC
# (Proxmox cannot run docker; this is the host-side packaging of the same
# toolset) and optionally bench a storage path through it.
#
# Usage (from workstation, via tests/remote.sh prox-file):
# lxc-bench-setup.sh [--ctid N] [--store /mnt/path] [--keep]
# --store PATH bind-mount host PATH into the LXC at /mnt/bench and bench it
# --keep leave the LXC running (default: destroyed after the run)
set -eu
CTID="${BENCH_CTID:-30099}"
STORE=""
KEEP=0
while [ $# -gt 0 ]; do
case "$1" in
--ctid) CTID="$2"; shift 2 ;;
--store) STORE="$2"; shift 2 ;;
--keep) KEEP=1; shift ;;
*) echo "unknown arg $1" >&2; exit 1 ;;
esac
done
cleanup() {
if [ "$KEEP" != 1 ] && pct status "$CTID" >/dev/null 2>&1; then
pct stop "$CTID" >/dev/null 2>&1 || true
pct destroy "$CTID" >/dev/null 2>&1 || true
fi
}
trap cleanup EXIT
# template: fetch the standard Debian 12 LXC template if missing
TPL=$(pveam list local 2>/dev/null | grep -oE 'local:vztmpl/[a-z0-9-]*debian-12-standard[^ ]*\.tar\.zst' | head -1 || true)
if [ -z "$TPL" ]; then
pveam update >/dev/null
DL=$(pveam available --section system 2>/dev/null | grep -oE 'debian-12-standard[^ ]*\.tar\.zst' | sort -V | tail -1)
[ -n "$DL" ] || { echo "[bench-lxc] ERROR: no debian-12 LXC template in pveam" >&2; exit 1; }
pveam download local "$DL" >/dev/null
TPL=$(pveam list local | grep -oE "local:vztmpl/$DL" | head -1)
fi
echo "[bench-lxc] template: $TPL"
MP=()
if [ -n "$STORE" ]; then
MP=(-mp0 "$STORE,mp=/mnt/bench")
fi
pct create "$CTID" "$TPL" --hostname perfbench --memory 1024 --cores 2 \
--rootfs local-lvm:8 --net0 name=eth0,bridge=vmbr0,ip=dhcp \
--unprivileged 1 --features nesting=0 "${MP[@]}" >/dev/null
pct start "$CTID"
sleep 5
# toolset in (same installer the guests use; piped in, nothing fetched from outside)
# libaio1 is gone on trixie (t64 transition); fio pulls the right one itself
pct exec "$CTID" -- bash -c "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq >/dev/null; apt-get install -y -qq fio iperf3 jq libaio1 >/dev/null || apt-get install -y -qq fio iperf3 jq >/dev/null"
BDIR="/mnt/bench"
[ -z "$STORE" ] && BDIR="/var/tmp"
echo "[bench-lxc] benching $BDIR on CT $CTID"
pct exec "$CTID" -- env BENCH_DIR="$BDIR" bash -s < "$(dirname "$0")/bench-run.sh"
echo "[bench-lxc] done"