Split into qemu and proxmox platforms over a shared content tree
platforms/qemu and platforms/proxmox each have their own lab.sh and lab.conf; content/ holds everything shared (roles, seed, site, helpers). The dispatcher, preflight and command implementations are common and take platform differences from the backend. Proxmox backend: qm create with q35/SATA/e1000, ISOs and seed ISOs in an ISO storage, provisioning over qm guest exec (no Python packages needed on the host), template + clone for reset, and peers/ to emit WireGuard configs. The role scripts now ride on the seed ISO, so provisioning transfers nothing. build-bundle.sh produces a self-contained tarball per platform, for hosts that cannot reach the git server. Both configs are generic: no absolute path from this machine remains.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# shellcheck shell=bash
|
||||
# cmd_init — create the storage layout. No ISOs downloaded yet (phase 3).
|
||||
|
||||
cmd_init() {
|
||||
step "storage layout"
|
||||
mkdir -p "$LAB_ROOT"/images "$LAB_ROOT"/seeds "$LAB_ROOT"/run "$LAB_ROOT"/logs
|
||||
ok "LAB_ROOT ${LAB_ROOT}"
|
||||
|
||||
# chattr +C must be set on the directory *before* any file is created in it,
|
||||
# otherwise btrfs keeps CoW for the existing tree.
|
||||
if [[ $(fstype_of "$LAB_ROOT") == btrfs ]]; then
|
||||
mkdir -p "$LAB_ROOT/images/base" "$LAB_ROOT/images/overlays"
|
||||
if chattr +C "$LAB_ROOT/images" 2>/dev/null; then
|
||||
if lsattr -d "$LAB_ROOT/images" 2>/dev/null | awk '{print $1}' | grep -q 'C'; then
|
||||
ok "images/ : +C set (CoW disabled)"
|
||||
else
|
||||
warn "images/ : chattr +C did not stick"
|
||||
fi
|
||||
else
|
||||
warn "images/ : chattr +C failed (btrfs?)"
|
||||
fi
|
||||
else
|
||||
mkdir -p "$LAB_ROOT/images/base" "$LAB_ROOT/images/overlays"
|
||||
info " images/ : $(fstype_of "$LAB_ROOT") — no +C needed"
|
||||
fi
|
||||
|
||||
step "iso cache"
|
||||
if is_mounted "$LAB_ISO_CACHE" || is_mounted "$(dirname "$LAB_ISO_CACHE")"; then
|
||||
mkdir -p "$LAB_ISO_CACHE"
|
||||
ok "ISO cache ${LAB_ISO_CACHE}"
|
||||
else
|
||||
warn "ISO cache parent $(dirname "$LAB_ISO_CACHE") is not mounted — skipped"
|
||||
fi
|
||||
|
||||
step "directories"
|
||||
for d in images/base images/overlays seeds run logs; do
|
||||
printf ' %-24s %s\n' "$d" "$([[ -d $LAB_ROOT/$d ]] && echo present || echo missing)"
|
||||
done
|
||||
|
||||
printf '\n'
|
||||
ok "layout ready — next: ./lab.sh check"
|
||||
}
|
||||
Reference in New Issue
Block a user