Repository navigation
fix: flush the image before importing a VM disk - #223
Open
michelroegl-brunner wants to merge 1 commit into
Open
michelroegl-brunner wants to merge 1 commit into
michelroegl-brunner wants to merge 1 commit into
Conversation
Freshly extracted or converted images leave gigabytes of dirty pages. On a
default ZFS install the image (rpool/var-lib-vz) and the target zvol
(rpool/data) share a pool, so the zvol create inside qm disk import hits
Proxmox's zfs command timeout ("got timeout") while ZFS writes them back.
vm_import_disk now runs a best-effort sync -f on the image first, which
covers every VM script at once instead of patching them one by one.
Refs community-scripts/ProxmoxVE#18580, community-scripts/ProxmoxVE#18581
Contributor
Try this branchThe engine and the scripts resolve independently, so a production script can COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/community-scripts/core/fix/vm-import-sync-before-zfs \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"Swap This PR touches Run a script from a fork as wellcurl -fsSL https://raw.githubusercontent.com/community-scripts/core/fix/vm-import-sync-before-zfs/tools/run.sh |
bash -s -- https://raw.githubusercontent.com/YOU/DevScripts/your-branch ct/debian.sh \
https://raw.githubusercontent.com/community-scripts/core/fix/vm-import-sync-before-zfsNote that Useful flags while testing
|
5 of 12 tasks
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.
✍️ Description
vm_import_disknow flushes the image to disk (sync -f "$file", falling back tosync, best effort) before it runsqm disk import.Images are usually freshly extracted or converted (xz, gzip, qemu-img, virt-customize), so gigabytes of dirty pages are still waiting to be written. On a default ZFS install the image (
rpool/var-lib-vz) and the target zvol (rpool/data) are in the same pool, so the zvol create inside the import runs into Proxmox's zfs command timeout (zfs create ... failed: got timeout) while ZFS writes those pages back. The reporter of community-scripts/ProxmoxVE#18580 narrowed it down: a sleep or async -fafter extraction fixes it, while a sleep before extraction does not.community-scripts/ProxmoxVE#18581 patches only
vm/haos-vm.sh. Every VM script goes throughvm_import_disk(haos, pimox-haos, openwrt, opnsense, docker, ubuntu, unifi-os,vm-app.func), so fixing it here covers all of them at once.pve/vm-core.func: flush before the import. A failed flush never blocks the import.tests/vm-helpers.sh: the flush runs beforeqm disk import, and the import still runs when the flush fails.docs/vm.md: helper table updated.Not included: a retry on
got timeoutlike OPNsense'spvesm allocloop. By the time that timeout fires the zvol has already been created, so a retry would need cleanup first. That's only worth adding if the flush turns out not to be enough.AI: Claude Opus 5.5 (low reasoning effort).
🔗 Related Issue
Fixes community-scripts/ProxmoxVE#18580
Supersedes community-scripts/ProxmoxVE#18581
✅ Prerequisites (X in brackets)
API.txtwas updated to match.Testing:
tests/vm-helpers.shpasses for allvm_import_diskcases, including the two new ones. It has not been tried on a real ZFS host yet. Incus is unaffected becausevm_import_diskis qm-only there. NoAPI.txtcoverspve/vm-core.func, so there is nothing to regenerate.🛠️ Type of Change (X in brackets)
README,docs/,CONTRIBUTING.md, or other docs.🤖 AI Assistance (X in brackets)