bench-run.sh: identical test shape everywhere (4k rand rw, 1M seq rw, direct IO, grep-able BENCH| lines) - runs in guests, LXCs, containers. install-bench.sh for Debian guests/LXCs; Dockerfile for registry image; lxc-bench-setup.sh stands up the host-side bench LXC (proxmox = no docker). Ticket: https://projects.knownelement.com/issues/709
60 lines
2.1 KiB
Bash
60 lines
2.1 KiB
Bash
#!/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
|
|
pveam download local debian-12-standard_12.7-1_amd64.tar.zst >/dev/null
|
|
TPL=$(pveam list local | grep -oE 'local:vztmpl/[a-z0-9-]*debian-12-standard[^ ]*\.tar\.zst' | 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)
|
|
pct exec "$CTID" -- bash -c "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq >/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"
|