Repository navigation
audit: v0.8.1 flow read, five fixes and docs - #346
Merged
Merged
Conversation
A commit renames its new file in under the flock and fsyncs only after it drops the flock. A second writer that took the flock in that gap rotated the unsynced file into .prev and unlinked the last generation that was on disk. A power loss before either fsync finished could then leave main and .prev both without data, and every verb on that namespace failed as corrupt until a manual repair. The rotation now syncs main first. It costs one fsync call on a file that is clean whenever the writer before has finished its own.
…osed A full subscriber queue dropped the event and said nothing, so a client that was reading kept a VM at its old state until that VM changed again; one pass that changes more than 128 VMs is enough. The subscriber is now removed and its stream closed: the client reconnects and gets a fresh snapshot. The pass still never blocks. docs/daemon.md also says that a power loss can lose the last ledger entries, which the ledger never fsyncs.
The event diff compared id, name, state, vCPUs, memory, IPs and image. Since vm resize the disk size changes too, and a resize of only the disk emitted no MODIFIED.
The disk tools run to their end on a cancel, but the record update after them used the canceled context, so the command failed with the disk grown and the old size on record until the same resize was run again. Once the disk has grown the record is written on a detached context, as vm start does after a launch. The hint for a Windows cloud image names a Windows command; it named growpart and resize2fs.
…t commit The commit that marks the VM stopped after the kill logged its error and the restore went on. The final commit then set a new start over the interval that was still open: the ledger got a second compute.start and the first never got its stop. The restore now returns the error before it touches the run dir; the VMM is dead and the record still open, so the next restore or start closes the interval once.
… steps On the published win11 image a Recovery partition sits right behind C:, so Resize-Partition alone leaves C: at its old size after vm resize --storage; the hint named that command and the docs named Disk Management, and neither works. The hint now says what is in the way, and docs/windows.md has the steps measured on hardware (reagentc /disable, remove the Recovery partition, Resize-Partition) with what they cost: the guest loses its recovery environment.
…covery partition The example piped every partition of type Recovery on every disk into Remove-Partition. Only the one directly behind C: is in the way: the steps now list C:'s disk and remove that partition by disk and partition number.
…ve letter The text tells the reader to take two numbers from the listing, and the listing showed only one of them.
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.
What
A flow read of v0.8.1. The per-file ledger was at zero for every lens, but 115 of the 258 production files sat in no declared flow, so the windows that cross them had never been walked. Seven new flows cover them, and an eighth reader re-read
vm resizeindependently. This PR carries what the read found.Fixes
meta/json/store.go.prevand unlinked the last generation on disk. A power loss before either fsync finished could leave main and.prevboth empty: every verb on the namespace fails as corrupt until a manual repair.daemon/cache.gocmd/vm/status.govm status --eventcompared seven fields and the disk size was not one of them, so a storage-onlyvm resizeemitted noMODIFIED.hypervisor/resize.govm startdoes after a launch.hypervisor/restore.gocmd/vm/resize.go,docs/windows.mdgrowpartandresize2fs, and the docs named Disk Management. Neither works on the publishedwin11image: a Recovery partition sits right behind C:.README.md,docs/install.mdvm resize.docs/daemon.mdEach code fix has a test that fails on v0.8.1.
Kept without code
updateVM, the delete protocol, snapshot create and remove). A process death between the two loses the entry. docs/daemon.md states this contract, and downstream tolerates an unpaired endpoint..tmp-*file after a SIGKILL inside a json commit. One stray copy per kill inside a millisecond window; it is never read.vm restore --from-diron a directory whose snapshot files are symlinks passes preflight and then cannot populate. cocoon's export writes regular files only and no known producer writes symlinks.snapshot export --to-dirruns into one directory at once can mix their files. The target directory belongs to the caller.qemu-img resizeis killed by a cancel. A qcow2 grow is crash-consistent; the retry runs it again.Read with no finding
Balloon runtime, bridge NIC lifecycle, the lock and lease primitives, and the independent read of
vm resize. Reports name the windows and the lines that close each.Decisions for the maintainer
Size and cost
fsynccall per json-engine commit (measured below).vm start, clone, stop, restore and rm do no new work on their success path, and the timing row shows none.Gates: golangci-lint 0 issues on linux and darwin, fmt, vet,
go mod tidy -diff, asl on both;go test -raceon darwin (39 packages) and in a linux container (40 packages).Coverage
Hardware: bare metal, x86_64, kernel 6.12, XFS; Cloud Hypervisor v56.0.0-dev-5fd961f7 and the pinned Firecracker fork build; head e635963 against v0.8.0 (6d4952a) for the regression and timing, against v0.8.1 for the store benchmark. The contrasts and thresholds were written down before the run. The last two commits of this branch (the Windows hint and docs) came after the run and change no measured path.
r.sh: CH and FC, CNI NICs, clone, restore, hibernate, disk and NIC hot-plug, cloud image, snapshots, gc)vm resize --storagewhileresize2fsruns (a stand-in sleeps 3 s first)vm resize --storage+10G, thenResize-Partitionalonereagentc /disable, removal of the Recovery partition, thenResize-Partition