Skip to content

Builder: add --rebuild and a VMID_DEFAULT per profile - #61

Merged
modem7 merged 1 commit into
masterfrom
rebuild-all-vmid
Oct 23, 2026
Merged

modem7 merged 1 commit into
masterfrom
rebuild-all-vmid

Conversation

@modem7

@modem7 modem7 commented Oct 23, 2026

Copy link
Copy Markdown
Owner

What

Makes a monthly "recreate everything" run possible: ./build-templates.sh all --rebuild --verify.

  • VMID_DEFAULT per profile. The examples now have 52000 (base), 52001 (extras) and 52002 (desktop). The builder default no longer gives every profile the same --vmid 52000: with no create args it passes each profile's own VMID_DEFAULT with --auto-vmid (a profile without one still gets 52000, so older configs behave as before). --auto-vmid on its own would start at 100, so --vmid is still passed.
  • --rebuild. Replaces each existing template in place, using the create script's --force-overwrite --i-know-what-i-am-doing: the new image is built first and only then is the old template destroyed and recreated. The create script still refuses anything that is not a stopped template. Accepted anywhere before --, like --verify; it cannot be combined with explicit create args, --generate-only or --init.
  • Pre-flight, before any build starts. With --rebuild the builder stops if a profile has no valid VMID_DEFAULT, if two profiles share one (the second would overwrite the first), or if a template still has linked clones (qm destroy would fail after the long build). The linked-clone check looks at the local node's /etc/pve/qemu-server.
  • --verify with --rebuild. Replacing a template reuses its ID, so the usual "the one new VMID" detection finds nothing. With --rebuild the profile's own ID is verified instead; --keep still works.
  • Help text and README updated, including a "Rebuilding in place" section.

Testing

bash -n and shellcheck are clean. Checked against a mocked qm and a stub create script, on a copy with the root check removed: argument parsing and the errors above; default args (including IDs already taken) and --rebuild args; three profiles generated with their own VMID_DEFAULT; duplicate, missing and invalid IDs; linked-clone detection with a fake config folder (base-52001- matched, base-520010- not); --rebuild --verify and --keep; plain --verify unchanged; real --help and --init.

Not run on a real Proxmox host. The create script's real --force-overwrite run, and its loading of VMID_DEFAULT from --config, were checked by reading the code only. Linked clones on other cluster nodes are not detected.

@modem7
modem7 merged commit c18b7df into master Oct 23, 2026
4 checks passed
@modem7
modem7 deleted the rebuild-all-vmid branch October 23, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant