Route KVM suite temp files to larger volumes
Some checks failed
KVM Publishable Validation / publishable-kvm-suite (push) Failing after 11m56s

This commit is contained in:
centra 2026-04-05 04:01:50 +09:00
parent 26a306da1c
commit c1c610d2db
2 changed files with 38 additions and 0 deletions

View file

@ -57,6 +57,9 @@ jobs:
if [[ -f /sys/module/kvm_amd/parameters/nested ]]; then if [[ -f /sys/module/kvm_amd/parameters/nested ]]; then
echo "kvm_amd_nested=$(cat /sys/module/kvm_amd/parameters/nested)" echo "kvm_amd_nested=$(cat /sys/module/kvm_amd/parameters/nested)"
fi fi
echo "runner_temp=${RUNNER_TEMP}"
df -h / /tmp /var/tmp "$RUNNER_TEMP" || true
df -h /nix || true
- name: Run Publishable KVM Suite - name: Run Publishable KVM Suite
run: | run: |

View file

@ -13,6 +13,27 @@ log() {
printf '[publishable-kvm-suite] %s\n' "$*" printf '[publishable-kvm-suite] %s\n' "$*"
} }
choose_runtime_root() {
local candidate avail best="" best_avail=-1
for candidate in /nix/var/tmp /var/tmp /tmp "${HOME}"; do
mkdir -p "${candidate}" 2>/dev/null || continue
avail="$(df -Pk "${candidate}" 2>/dev/null | awk 'NR==2 { print $4 }')"
[[ -n "${avail}" ]] || continue
if (( avail > best_avail )); then
best="${candidate}"
best_avail="${avail}"
fi
done
[[ -n "${best}" ]] || {
log "no writable runtime root found"
return 1
}
printf '%s\n' "${best}/ultracloud-publishable-kvm-suite"
}
get_hostname() { get_hostname() {
if command -v hostname >/dev/null 2>&1; then if command -v hostname >/dev/null 2>&1; then
hostname hostname
@ -21,6 +42,16 @@ get_hostname() {
fi fi
} }
prepare_runtime_dirs() {
local runtime_root
runtime_root="$(choose_runtime_root)"
export ULTRACLOUD_KVM_RUNTIME_ROOT="${runtime_root}"
export TMPDIR="${runtime_root}/tmp"
export XDG_CACHE_HOME="${runtime_root}/xdg-cache"
mkdir -p "${TMPDIR}" "${XDG_CACHE_HOME}"
}
capture_environment() { capture_environment() {
{ {
printf 'started_at=%s\n' "$(date -Is)" printf 'started_at=%s\n' "$(date -Is)"
@ -33,6 +64,9 @@ capture_environment() {
printf 'branch=%s\n' "$(git -C "${REPO_ROOT}" branch --show-current)" printf 'branch=%s\n' "$(git -C "${REPO_ROOT}" branch --show-current)"
printf 'commit=%s\n' "$(git -C "${REPO_ROOT}" rev-parse HEAD)" printf 'commit=%s\n' "$(git -C "${REPO_ROOT}" rev-parse HEAD)"
printf 'nix_version=%s\n' "$(nix --version)" printf 'nix_version=%s\n' "$(nix --version)"
printf 'runtime_root=%s\n' "${ULTRACLOUD_KVM_RUNTIME_ROOT:-}"
printf 'tmpdir=%s\n' "${TMPDIR:-}"
printf 'xdg_cache_home=%s\n' "${XDG_CACHE_HOME:-}"
printf 'kvm_present=%s\n' "$([[ -e /dev/kvm ]] && echo yes || echo no)" printf 'kvm_present=%s\n' "$([[ -e /dev/kvm ]] && echo yes || echo no)"
if [[ -e /dev/kvm ]]; then if [[ -e /dev/kvm ]]; then
printf 'kvm_stat=%s\n' "$(stat -c '%A %U %G %t:%T' /dev/kvm)" printf 'kvm_stat=%s\n' "$(stat -c '%A %U %G %t:%T' /dev/kvm)"
@ -79,6 +113,7 @@ run_case() {
} }
main() { main() {
prepare_runtime_dirs
capture_environment capture_environment
[[ -e /dev/kvm ]] || { [[ -e /dev/kvm ]] || {