fix(create-proxmox-resource): fix VM disk never attaching after import #66
Closed
beatzaplenty
wants to merge 1 commits from
worktree-warm-discovering-moon into main
pull from: worktree-warm-discovering-moon
merge into: :main
:main
:feature/ha-docker-swarm
:worktree-reflective-puzzling-frog
:worktree-crispy-churning-kernighan
:worktree-partitioned-swimming-pizza
:worktree-pve1-nix-cache-builder
:worktree-docs-beszel-guide
:worktree-ha-resize-disk
:worktree-functional-mapping-russell
:worktree-ha-file-server-test
:worktree-parsed-mapping-raven
:worktree-full-sweep
:worktree-docker-ipa-group
:worktree-ipa-lxc-kerberos-fix
:worktree-ipa-common-config
:worktree-docker-gui-fix
:worktree-ipa-client-module
:worktree-peaceful-stirring-noodle
:fix/static-ips
:worktree-beszel-tailscale-router
:worktree-lovely-spinning-bubble
:worktree-polished-wandering-toast
:worktree-warm-discovering-moon
:worktree-gentle-cuddling-hippo
:fix-stale-wording
:fix-sync-host-keys-clan-vars
:worktree-phase0-provision-ordering-fix
:worktree-fix-tailscale-host-dir
:worktree-push-host-keys
:worktree-tailscale-subnet-router-rename
:worktree-tor-relay-beszel
:worktree-rippling-riding-snail
:server-boot-fix
:worktree-zesty-wishing-knuth
:worktree-harmonic-jingling-bee
:worktree-reactive-gliding-map
:worktree-baremetal-esp-unmount
:worktree-baremetal-emergency-access
:worktree-fix-zfs-install-export
:worktree-gui-wifi-module
:worktree-parallel-host-eval
:worktree-migrate-vm-script
:worktree-pxe-menu-rename-and-minimal
:worktree-fix-pxe-netboot-hang
:worktree-clone-pve1-to-pve-test
:worktree-claude-md-pve-guardrails
:worktree-fix-container-dns-search-domain
:worktree-flake-e2e-audit
:worktree-maintenance-script-changed-files-only
:worktree-fix-nix-cache-host-key
:add-claude-builder-key
:worktree-refactor-scripts-shared-lib
:worktree-nix-cache-502-fix
:worktree-nix-cache-client-script
:fix-proxmox-remote-build-bootstrap
:worktree-proxmox-remote-build
:worktree-fix-lxc-docker-nfs-mounts
:add-backup-admin-key-script
:worktree-rotate-admin-key-script
:fix-stale-docs
:worktree-fix-duplicate-host-check-exitcode
:worktree-scripts-dedup
:remove-deploy-status-from-readme
:fix-duplicate-host-self-match
:worktree-nix-cache-lxc-migration
:worktree-fizzy-juggling-sedgewick
:fix-nix-cache-probe-retry
:worktree-starry-painting-whistle
:worktree-tailscale-exit-node
:refactor/secrets
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c90f2cffc0 |
fix(create-proxmox-resource): fix VM disk never attaching after import
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m31s
Three bugs combined to leave every VM build with a shell but no boot disk: 1. The remote build script moved the raw image to /var/lib/vz/import/ before qm importdisk could use it. If the mv failed (cross-filesystem copy, sudo path, or any other reason) the remote script exited non-zero -- but the local script's set -e handling of the SSH heredoc was inconsistent, so qm create sometimes ran anyway, leaving a diskless VM shell. Fix: skip the mv entirely. The diskoImagesScript writes <hostname>.raw into its CWD (the remote repo dir, $out = $PWD at invocation). Import directly from that path; clean it up after a successful import. 2. The qm importdisk output regex expected "Successfully imported disk as '...'" but current Proxmox emits "unusedN: successfully imported disk '...'" (lowercase, no "as"). The grep returned no match and exited 1. 3. The disk_id assignment used $(... | grep ...) without || true inside the substitution. With set -euo pipefail, a non-zero grep exit aborts the script before the fallback could run -- so the VM was always left with an unattached unused0 disk. Fix: update the primary regex to match the actual PVE format; add || true inside the substitution so set -e never fires on a grep miss; add a qm config fallback (scan for unusedN: lines) that works regardless of PVE output format changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011uRcikkTp3D5VbXj2DwNpQ |