restore: gate static-file offload on SLOWDISK env var (.env), not just /slowdisk presence
A `/slowdisk` directory exists on hosts even when it is just a folder on the root disk (no dedicated extra disk) — offloading there gives no benefit. Source the host .env and require SLOWDISK to be set (operator sets it only on hosts with a real extra disk mounted at /slowdisk) before activating the static-file -> /slowdisk symlink offload. Unset = normal extract everywhere. Target path stays /slowdisk (the fixed in-container mount). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
dir="$(dirname "$0")"
|
||||
source "$dir/volume-utils.sh"
|
||||
# Host config: SLOWDISK gates the static-file offload (see prep_static_offload). It must be
|
||||
# set ONLY on hosts that have a real dedicated extra disk mounted at /slowdisk; on hosts
|
||||
# where /slowdisk is just a folder on the root disk, offloading gives no benefit.
|
||||
[ -f "$dir/.env" ] && source "$dir/.env"
|
||||
|
||||
remote_source="$2"
|
||||
if [[ -n "$remote_source" ]] && is_local_backup_url "$remote_source"; then
|
||||
@@ -24,9 +28,12 @@ fi
|
||||
# hot/dynamic state stays on the primary disk. tar then extracts THROUGH the symlinks via
|
||||
# --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them).
|
||||
# Target naming matches delete-volumes.sh / delete_slowdisk_targets_for_key cleanup.
|
||||
# Safe fallbacks (just extract normally): no /slowdisk, no manifest, or no static paths.
|
||||
# GATED on the SLOWDISK env var from .env: only hosts with a real dedicated extra disk set
|
||||
# it. Safe fallbacks (just extract normally): SLOWDISK unset, /slowdisk missing, no manifest,
|
||||
# or no static paths. (/slowdisk is the fixed in-container mount, so the target path is fixed.)
|
||||
prep_static_offload() {
|
||||
local key=$1 meta=$2 data_dir=$3 rel target
|
||||
[ -n "${SLOWDISK:-}" ] || { echo " SLOWDISK not set in .env (no dedicated extra disk) — no static offload"; return 0; }
|
||||
[ -d /slowdisk ] || { echo " /slowdisk absent — no static offload"; return 0; }
|
||||
[ -f "$meta" ] || { echo " no manifest ($meta) — no static offload"; return 0; }
|
||||
# manifest data lines (after the 3-line header) are "<size> <relpath>"
|
||||
|
||||
Reference in New Issue
Block a user