fix(proxmox): auto-select snippets-capable storage for cloud-init#154
Merged
Conversation
The cloud-init snippet path (qemu-guest-agent enablement + E1 packages/runcmd) required the configured/disk storage to hold snippets; on a local-lvm-only node it silently no-op'd, which stalls DHCP-mode IP discovery for ~10 minutes and drops requested node prep. - client.PickSnippetsStorage (pure, unit-tested): prefer the configured storage when it's snippets-capable, else the node's first snippets-capable storage (sorted), else ok=false. - The handler resolves the storage via ListNodeStorages before uploading, so an LVM-default node still lands its snippet on e.g. "local". - Fail-fast: when a VM explicitly requested packages/runcmd and the node has no snippets-capable storage, create returns an actionable error instead of a silently-broken node. The best-effort agent-only case still degrades gracefully (logged, non-fatal), preserving prior behavior. Hardens both the bootstrap QGA path and the E1 per-VM vendor snippet (they share applyCloudInitVendorSnippet). Tests: PickSnippetsStorage (prefer/fallback/none); handler auto-select (LVM default → snippet on local) and fail-fast (no snippets storage → error); existing E1 handler test updated to serve /storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-select a snippets-capable storage (Bootstrap QGA robustness follow-up)
The cloud-init snippet path — qemu-guest-agent enablement and the E1
packages/runcmdvendor snippet — required the configured/disk storage to hold snippets. On alocal-lvm-only node it silently no-op'd, which stalls DHCP-mode IP discovery for ~10 minutes and drops requested node prep. This is the "real fix" the roadmap's[~]QGA item called for.Change
client.PickSnippetsStorage(storages, preferred)— pure, unit-tested: prefer the configured storage when it's snippets-capable, else the node's first snippets-capable storage (sorted for determinism), elseok=false.ListNodeStoragesbefore uploading, so an LVM-default node still lands its snippet on e.g.local.packages/runcmdand the node has no snippets-capable storage,createreturns an actionable error instead of producing a silently-broken node (e.g. Longhorn'sopen-iscsinever installed). The best-effort agent-only case (no packages/runcmd) still degrades gracefully — logged, non-fatal — preserving prior behavior.Hardens both the bootstrap QGA path and the just-shipped E1 per-VM vendor snippet (they share
applyCloudInitVendorSnippet).Tests
PickSnippetsStorage: prefer-configured, fallback-when-preferred-incapable, fallback-when-no-preferred, none-capable.local,cicustom=vendor=local:…) and fail-fast (no snippets storage + packages → error). Existing E1 handler test updated to serve/storage.Local CI: build,
go test ./...(+-raceon proxmox), gofmt, vet, staticcheck, golangci-lint (0 issues), modernize — root and the proxmox plugin module — all green.