microvm: serve durable-dir volumes through the one kataShared virtiofsd - #1034
Open
Lucky Abolorunke (Oneimu) wants to merge 1 commit into
Open
microvm: serve durable-dir volumes through the one kataShared virtiofsd#1034Lucky Abolorunke (Oneimu) wants to merge 1 commit into
Lucky Abolorunke (Oneimu) wants to merge 1 commit into
Conversation
Lucky Abolorunke (Oneimu)
force-pushed
the
durdir-single-share
branch
from
August 18, 2026 03:01
255fa83 to
7bf72d1
Compare
Contributor
Author
|
/assign Benjamin Elder (@BenTheElder) |
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 Changed and Why
Durable-dir volumes were previously served to the guest by a second per-actor
virtiofsd. That arrangement predates the writablekataSharedshare: when the rootfs share was a read-only lower, a writable durable share had to be its own device. Since #846, thekataSharedtree is writable and served with--announce-submounts, making the second daemon redundant—it cost an extra process andvhostsocket per actor, an extrafsdevice in every snapshot config, and a restore-time revival of all three.This PR folds the durable-dir volumes into the single existing share:
_durable):kata.BindIntoSharebind-mounts theatelet-owned volumes directory into the served tree as its_durablesubtree. The leading underscore keeps it out of the container-ID namespace (container names are RFC 1123 labels and cannot begin with an underscore). The guest sees it as a submount of thekataSharedmount, and containers bind their volumes from<shared>/_durable/<volume>exactly as they previously did from the second share.Cold boot no longer spawns the durable
virtiofsd, and the VM configuration carries exactly onevirtio-fsdevice.ateletstill owns the directory (creates it before boot, wipes it on actor reset). The bind isateom-owned mount state, detached byCleanupSandboxStatebefore any removal, ensuringatelet's data is never touched through it.Checkpoints tar the host directory directly under every scope, exactly as before.
Note
The bind uses the same mechanism the per-container merged rootfs mounts already use through this
virtiofsd(submounts inside the served tree, re-opened byfind-pathson restore), introducing no new guest-side behavior.BindIntoShare's doc comment establishes this pattern for future per-actor shares: mount a reserved subtree rather than adding a device (relevant to in-flight work such as #803; #923 already follows this subtree approach).Compatibility with Existing Snapshots
Restore is self-describing in both directions:
A snapshot whose
config.jsoncarries anateDurablefs device originates from the two-share era. The resumed guest still expects that device, so restore revives the secondvirtiofsdexactly as before (stageLegacyDurableShare). Such a lineage remains two-share across its own re-checkpoints sincecloud-hypervisorre-emits the device.A snapshot without the device gets the volumes re-bound into the shared tree before
virtiofsdstarts, allowingfind-pathsto re-open the guest's open durable files at their_durable/...paths, which the restored tar reproduces exactly.Detection logic lives in
rewriteSnapshotSocketPaths, which already inspects the configuration'sfsdevices. The configuration acts as the authority because the device is whatcloud-hypervisorre-opens, regardless of the actor's spec.How This Was Tested
rewriteSnapshotSocketPathsclassifies single-device and two-device snapshot configs correctly (routing restore to the bind vs. the legacy share).kata-packagetest pinning_durablesubtree invariants: the underscore namespace reservation, the guest path residing inside the singlekataSharedmount, and host/guest agreement on the relative path re-opened byfind-paths.mainbefore this change to exercise the legacy two-share fallback path.