[PR #2] [MERGED] installer: fix the state volume against a real PVE node #4

Closed
opened 2026-10-15 12:52:34 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/proxmox-community-script/pull/2
Author: @JBailes
Created: 8/9/2026
Status: ✅ Merged
Merged: 8/9/2026
Merged by: @JBailes

Base: main ← Head: fix/installer-state-volume-real-vmid


📝 Commits (1)

  • 5dd2a2d installer: fix the state volume against a real PVE node

📊 Changes

2 files changed (+72 additions, -22 deletions)

View changed files

📝 install.sh (+49 -20)
📝 tests/state-volume-dryrun.sh (+23 -2)

📄 Description

Verified the state-volume section on a live Proxmox 9.2.6 host (local-lvm / lvmthin) rather than stubs alone. Two defects surfaced, one of them data loss — neither visible to the faked pvesm.

1. vmid 0 does not exist

$ pvesm alloc local-lvm 0 vm-0-wolf-state 1G
400 Parameter verification failed.
vmid: invalid format - value does not look like a valid VM ID

Allocation failed on the very first real call. The volume now takes the first free id from 9000 upward (no qemu-server/ or lxc/ config for it), clear of the ids the daemon hands to session CTs, overridable with WOLF_STATE_VMID. It is found again by its wolf-state suffix whatever id owns it, and the resolved volid is written to .env as WOLF_STATE_VOLUME so a re-run adopts exactly that one.

2. Stale content under the mount point overwrote live data

The migration copied /etc/wolf onto the volume unconditionally and never emptied the mount point afterwards. Once Wolf owns the volume, whatever remains underneath is stale — so any later run (after an unmount, or a reboot before fstab mounts) copied it back over the top, rolling config.toml and client pairings backwards.

Seeding now happens only onto an empty volume, and the mount point is emptied once the copy succeeds.

Red before green, on hardware:

pre-fix fixed
live data on volume, stale copy underneath CONFIG-NOW: STALE-CONFIG ❌ CONFIG-NOW: LIVE-CONFIG ✅

Verification

The full section ran end to end on the node — allocate → mkfs → migrate → mount → fstab by UUID — plus re-runs both mounted (short-circuits) and unmounted (reuses the volume, does not reformat, does not clobber). Confirmed directly that a blank volume gives blkid -p rc=2 and a formatted one rc=0, which is what the no-reformat guard keys off.

Every artefact was removed afterwards: volume freed, scratch dir and scripts deleted, pvesm list clean.

tests/state-volume-dryrun.sh grows both regressions (15 assertions): vmid 0 is never passed to pvesm alloc, and a populated volume is left alone rather than overwritten from the mount point. tests/gather-dryrun.sh 14/14 unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/proxmox-community-script/pull/2 **Author:** [@JBailes](https://github.com/JBailes) **Created:** 8/9/2026 **Status:** ✅ Merged **Merged:** 8/9/2026 **Merged by:** [@JBailes](https://github.com/JBailes) **Base:** `main` ← **Head:** `fix/installer-state-volume-real-vmid` --- ### 📝 Commits (1) - [`5dd2a2d`](https://github.com/games-on-whales/proxmox-community-script/commit/5dd2a2d978d493c17258cef17a5443720fa7eebd) installer: fix the state volume against a real PVE node ### 📊 Changes **2 files changed** (+72 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `install.sh` (+49 -20) 📝 `tests/state-volume-dryrun.sh` (+23 -2) </details> ### 📄 Description Verified the state-volume section on a live **Proxmox 9.2.6** host (`local-lvm` / lvmthin) rather than stubs alone. Two defects surfaced, one of them data loss — neither visible to the faked `pvesm`. ## 1. `vmid 0` does not exist ``` $ pvesm alloc local-lvm 0 vm-0-wolf-state 1G 400 Parameter verification failed. vmid: invalid format - value does not look like a valid VM ID ``` Allocation failed on the very first real call. The volume now takes the first free id from 9000 upward (no `qemu-server/` or `lxc/` config for it), clear of the ids the daemon hands to session CTs, overridable with `WOLF_STATE_VMID`. It is found again by its `wolf-state` suffix whatever id owns it, and the resolved volid is written to `.env` as `WOLF_STATE_VOLUME` so a re-run adopts exactly that one. ## 2. Stale content under the mount point overwrote live data The migration copied `/etc/wolf` onto the volume unconditionally and never emptied the mount point afterwards. Once Wolf owns the volume, whatever remains underneath is stale — so any later run (after an unmount, or a reboot before fstab mounts) copied it back over the top, rolling `config.toml` and client pairings backwards. Seeding now happens **only onto an empty volume**, and the mount point is emptied once the copy succeeds. Red before green, on hardware: | | pre-fix | fixed | |---|---|---| | live data on volume, stale copy underneath | `CONFIG-NOW: STALE-CONFIG` ❌ | `CONFIG-NOW: LIVE-CONFIG` ✅ | ## Verification The full section ran end to end on the node — allocate → `mkfs` → migrate → mount → fstab by UUID — plus re-runs both mounted (short-circuits) and unmounted (reuses the volume, does not reformat, does not clobber). Confirmed directly that a blank volume gives `blkid -p` rc=2 and a formatted one rc=0, which is what the no-reformat guard keys off. Every artefact was removed afterwards: volume freed, scratch dir and scripts deleted, `pvesm list` clean. `tests/state-volume-dryrun.sh` grows both regressions (15 assertions): `vmid 0` is never passed to `pvesm alloc`, and a populated volume is left alone rather than overwritten from the mount point. `tests/gather-dryrun.sh` 14/14 unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 12:52:34 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/proxmox-community-script#4
No description provided.