Skip to content

fix(fc): re-anchor clone drives at their own paths after snapshot load#88

Merged
CMGS merged 2 commits into
masterfrom
fix-fc-clone-drive-anchor
Jul 5, 2026
Merged

fix(fc): re-anchor clone drives at their own paths after snapshot load#88
CMGS merged 2 commits into
masterfrom
fix-fc-clone-drive-anchor

Conversation

@CMGS

@CMGS CMGS commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Snapshots taken of an FC clone could not be restored: snapshot/load reopens the drive paths embedded in the vmstate, clone satisfies them with temporary symlink redirects, and the loaded VMM's device config keeps naming the source's paths. A later vm hibernate/snapshot save of the clone embeds those dangling paths, and its restore dies with Error manipulating the backing file: No such file or directory on the source COW (the golden builder's run dir, long gone).

Fix: after resume, PATCH /drives/{id} repoints each redirected drive at the clone's canonical path — same inode through the redirect, so the guest observes nothing; every future snapshot of the clone now embeds paths that exist at restore time.

Found by the sandbox control-plane e2e (its warm pool is golden clones; the new hibernate → transparent-wake smoke step failed exactly here), reproduced and verified on hardware: with this fix the full suite passes, including clone → hibernate (467ms end-to-end through the SDK relay, session state intact after wake). make lint test green.

CMGS added 2 commits July 6, 2026 02:11
FC's snapshot/load reopens the drive paths embedded in the vmstate, so
clone satisfies them with temporary symlink redirects — but the loaded
VMM's device config keeps naming the source's paths. Any later snapshot
of the clone (vm hibernate, vm snapshot) embeds those dangling paths
and its restore fails with ENOENT on the source COW. PATCH /drives
after resume repoints each redirected drive at the clone's canonical
path (same inode, so the guest sees nothing), making the clone's future
snapshots self-contained.
The fix's invariant — every redirected drive gets re-anchored — lived
in two textually-duplicated guards that could drift apart silently.
redirectedDriveIndices is now the single source for both loops, and
unit tests pin createDriveRedirects to it.
@CMGS

CMGS commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Review applied: the redirect and re-anchor loops now both derive from a single redirectedDriveIndices, making the must-match invariant structural instead of two textually-identical guards. TestRedirectedDriveIndices covers the pure function (equal/differing/shorter-dst/empty) and TestCreateDriveRedirectsMatchesIndices pins the symlink set to it on a real filesystem (including the backup-rename and created-dir branches) — the regression guard this fix previously only had via the hardware e2e.

@CMGS CMGS merged commit 2c4b063 into master Jul 5, 2026
6 checks passed
@CMGS CMGS deleted the fix-fc-clone-drive-anchor branch July 5, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant