installer 1.38.0 on main (NOT tagged): an appliance install stops on a system disk below 200 GB; --accept-small-disk for the operator (D83, R-1370); R-1398 filed
gates / gates (push) Failing after 4m26s
gates / gates (push) Failing after 4m26s
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
44715fb38b
commit
92853bed2c
6 files changed
+370
-5
No files matched your search
@@ -80,6 +80,10 @@
|
||||
#
|
||||
# Required:
|
||||
# --customer-id ID Customer (must already exist in the hub)
|
||||
# --accept-small-disk OPERATOR ONLY. An appliance install stops when the system disk (the disk
|
||||
# that holds the `pve` volume group) is below 200 GB, or when its size cannot
|
||||
# be read. This flag goes on, prints the cost and records small_disk in the
|
||||
# install state. A byo host is only warned and needs no flag (D83).
|
||||
# --mode appliance|byo Install profile (REQUIRED for install/--resume — no default):
|
||||
# appliance a Felhom-owned/managed box. Full Day-0 incl. the
|
||||
# break-glass root@pam credential (step 4b).
|
||||
@@ -194,7 +198,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_VERSION="1.37.0" # the SINGLE version source (F-1): -h and the run banners follow it.
|
||||
SCRIPT_VERSION="1.38.0" # the SINGLE version source (F-1): -h and the run banners follow it.
|
||||
# The hub used to carry a copy for its Setup tab; R-94 DELETED it
|
||||
# (2026-08-02) because the hub cannot know which version a box runs —
|
||||
# the Setup command fetches this script at run time. scripts/
|
||||
@@ -280,6 +284,7 @@ PRESERVE_FROM=""
|
||||
PRESERVE_STATE_FROM="" # dir holding a prior local-api.{crt,key} + local-tokens.log to carry over (keeps the pin stable across a reinstall)
|
||||
ALLOW_NEW_LEAF=false # opt-in to intentionally regenerate the agent leaf on a populated host (else the guard refuses)
|
||||
FORCE=false
|
||||
ACCEPT_SMALL_DISK=false # --accept-small-disk (D83, `16` §14.5): the operator's named way past the 200 GB rule
|
||||
FORCE_GITEA_GOLDEN=false
|
||||
SKIP_PROVISION=false
|
||||
DRY_RUN=false
|
||||
@@ -370,6 +375,11 @@ AGENT_CONFIG="" # resolved in preflight
|
||||
# old name called it a hard floor while the check only warned. No measured floor exists. Pinned by
|
||||
# scripts/test_hostinstall.py (test_lvm_minimum_is_named_as_what_it_does).
|
||||
RECOMMENDED_MIN_LVM_GIB=120
|
||||
# D83 (operator, 2026-11-15; felhom.eu `09` §3 decision 308; `16-storage-physical-identity.md` §14.5): the smallest
|
||||
# system disk is 200 GB — 200 × 10^9 bytes, so a disk sold as "200 GB" (200,049,647,616 bytes) and a virtual disk
|
||||
# made as "200G" (200 GiB) both pass, and a 128 GB or 180 GB disk does not.
|
||||
SYSTEM_DISK_MIN_BYTES=200000000000
|
||||
SYS_BLOCK_DIR="${SYS_BLOCK_DIR:-/sys/block}" # where the kernel says a disk's size (a test points it elsewhere)
|
||||
|
||||
# Runtime carriers (never logged)
|
||||
PASSPHRASE=""
|
||||
@@ -1760,6 +1770,7 @@ while [[ $# -gt 0 ]]; do
|
||||
--preserve-state-from) PRESERVE_STATE_FROM="$2"; shift 2 ;;
|
||||
--allow-new-leaf) ALLOW_NEW_LEAF=true; shift ;;
|
||||
--force) FORCE=true; shift ;;
|
||||
--accept-small-disk) ACCEPT_SMALL_DISK=true; shift ;;
|
||||
--force-gitea-golden) FORCE_GITEA_GOLDEN=true; shift ;;
|
||||
--skip-provision) SKIP_PROVISION=true; shift ;;
|
||||
--uninstall) UNINSTALL=true; shift ;;
|
||||
@@ -2143,6 +2154,9 @@ step_preflight() {
|
||||
command -v curl >/dev/null || die "curl not found"
|
||||
command -v python3>/dev/null || die "python3 not found"
|
||||
|
||||
# D83: the system disk's size, before anything is changed (a refused machine is exactly as it was).
|
||||
check_system_disk
|
||||
|
||||
local pvever; pvever=$(pveversion | head -1)
|
||||
# GL-2 PVE-major gate: byo installs are validated on PVE 9.x ONLY — on a host we don't own, an
|
||||
# unvalidated major is a refusal, not a warning. Appliance keeps the historical warn-only.
|
||||
@@ -2394,6 +2408,8 @@ step_preflight() {
|
||||
if ! $PREFLIGHT_ONLY; then
|
||||
_state_put customer_id "$CUSTOMER_ID"
|
||||
_state_put mode "$MODE"
|
||||
_state_put small_disk "${SMALL_DISK:-false}"
|
||||
_state_put system_disk_bytes "${SYSTEM_DISK_BYTES:-unknown}"
|
||||
_state_mark preflight
|
||||
fi
|
||||
log_success "pre-flight passed"
|
||||
@@ -2571,10 +2587,13 @@ step_enroll() {
|
||||
log_dry "curl -fsS -X POST $HUB_URL/api/v1/host-enroll -H 'X-Retrieval-Password: <pass>' -d '{\"customer_id\":\"$CUSTOMER_ID\"}'"
|
||||
HOST_ID="<dry-run-host-id>"; HOST_API_KEY="<dry-run-key>"; _state_mark enroll; return 0
|
||||
fi
|
||||
local resp code body
|
||||
local resp code body small_json=""
|
||||
# D83: an install that went on with --accept-small-disk says so to the hub (on a resume the flag is read from
|
||||
# the state record the preflight wrote). An older hub ignores the field.
|
||||
if [[ "${SMALL_DISK:-$(_state_get small_disk || true)}" == "true" ]]; then small_json=',"small_disk":true'; fi
|
||||
resp=$(curl -sS -w $'\n%{http_code}' -X POST "$HUB_URL/api/v1/host-enroll" \
|
||||
-H "X-Retrieval-Password: $PASSPHRASE" -H 'Content-Type: application/json' \
|
||||
-d "{\"customer_id\":\"$CUSTOMER_ID\"}")
|
||||
-d "{\"customer_id\":\"$CUSTOMER_ID\"${small_json}}")
|
||||
code=$(tail -n1 <<<"$resp"); body=$(sed '$d' <<<"$resp")
|
||||
case "$code" in
|
||||
201) log_success " host MINTED (first enroll)" ;;
|
||||
@@ -2591,6 +2610,66 @@ step_enroll() {
|
||||
_state_mark enroll
|
||||
}
|
||||
|
||||
# system_disk_bytes — print "<disk> <bytes>" for the ONE whole disk that holds the `pve` volume group, or print
|
||||
# nothing when that cannot be read (no `pve` group, two physical volumes, a RAID or another layer under it, no size).
|
||||
# READS ONLY: pvs, lsblk and one file under /sys/block. The size is the kernel's count of 512-byte sectors.
|
||||
system_disk_bytes() {
|
||||
local pvs_out n pv pk kind sectors
|
||||
pvs_out=$(pvs --noheadings -o pv_name -S vg_name=pve 2>/dev/null | awk 'NF {print $1}' || true)
|
||||
n=$(awk 'NF' <<<"$pvs_out" | wc -l)
|
||||
[[ "$n" -eq 1 ]] || return 0
|
||||
pv="$pvs_out"
|
||||
pk=$(lsblk -dno PKNAME "$pv" 2>/dev/null | awk 'NF {print $1; exit}' || true)
|
||||
[[ -n "$pk" ]] || return 0
|
||||
kind=$(lsblk -dno TYPE "/dev/$pk" 2>/dev/null | awk 'NF {print $1; exit}' || true)
|
||||
[[ "$kind" == "disk" ]] || return 0
|
||||
sectors=$(cat "$SYS_BLOCK_DIR/$pk/size" 2>/dev/null || true)
|
||||
[[ "$sectors" =~ ^[0-9]+$ && "$sectors" -gt 0 ]] || return 0
|
||||
echo "$pk $((sectors * 512))"
|
||||
}
|
||||
|
||||
# check_system_disk — D83: runs in the preflight, BEFORE anything is changed. Sets SMALL_DISK (true|false) and
|
||||
# SYSTEM_DISK_BYTES (a number, or "unknown") for the state record that step_preflight writes after its checks.
|
||||
# appliance, below 200 GB → stop (exit 1), nothing changed; --accept-small-disk goes on and prints the cost
|
||||
# appliance, size cannot be read → stop and name the flag; with the flag: go on, recorded as small
|
||||
# byo (the owner's own Proxmox) → a warning only, never a stop
|
||||
# no --mode (--preflight-only) → a warning only (the mode-specific rule needs the mode)
|
||||
check_system_disk() {
|
||||
local got disk bytes gb
|
||||
SMALL_DISK=false; SYSTEM_DISK_BYTES="unknown"
|
||||
got=$(system_disk_bytes)
|
||||
if [[ -z "$got" ]]; then
|
||||
if [[ "$MODE" != "appliance" ]]; then
|
||||
log_warn " could not read the system disk's size (no single disk under the 'pve' volume group). Felhom needs a system disk of 200 GB."
|
||||
return 0
|
||||
fi
|
||||
if $ACCEPT_SMALL_DISK; then
|
||||
SMALL_DISK=true
|
||||
log_warn " --accept-small-disk: the system disk's size cannot be read; the install goes on. Recorded as small_disk."
|
||||
return 0
|
||||
fi
|
||||
die "Cannot read the system disk's size (no single disk under the 'pve' volume group). Felhom needs a system disk of 200 GB. Nothing was changed. An operator can go on with --accept-small-disk."
|
||||
fi
|
||||
disk=${got%% *}; bytes=${got##* }
|
||||
SYSTEM_DISK_BYTES="$bytes"
|
||||
gb=$(( bytes / 1000000000 ))
|
||||
if [[ "$bytes" -ge "$SYSTEM_DISK_MIN_BYTES" ]]; then
|
||||
log_info " system disk: /dev/$disk, ${gb} GB (the minimum is 200 GB)"
|
||||
return 0
|
||||
fi
|
||||
if [[ "$MODE" != "appliance" ]]; then
|
||||
log_warn " this machine's system disk (/dev/$disk) is ${gb} GB. Felhom needs 200 GB: with less, the local copies of the box can stop when the disk fills. The install goes on (this host is yours)."
|
||||
return 0
|
||||
fi
|
||||
if $ACCEPT_SMALL_DISK; then
|
||||
SMALL_DISK=true
|
||||
log_warn " --accept-small-disk: this machine's system disk (/dev/$disk) is ${gb} GB, below the 200 GB that Felhom needs."
|
||||
log_warn " The cost: the guest gets less space than a household is promised, and the box's local copies can stop when the disk fills. Recorded as small_disk."
|
||||
return 0
|
||||
fi
|
||||
die "This machine's system disk is ${gb} GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a small test box with --accept-small-disk.)"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# STEP 5 — agent install: fetch+verify the binary, ensure the service user, sudoers, unit
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user