Skip to content

Commit 1627591

Browse files
authored
fix(vm): stop image workers before cleaning staging files
Run image preparation in an owned worker process, reserve its process identity until cleanup completes, and protect staging with leases so cancellation and recovery cannot race with another preparation attempt. Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 40e8e7d commit 1627591

5 files changed

Lines changed: 1717 additions & 46 deletions

File tree

‎crates/openshell-driver-vm/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ The requested sandbox image is never selected as the bootstrap image. Operators
219219
must configure either `bootstrap_image` or `default_image`; when both are empty,
220220
the driver fails during startup.
221221
222+
Image and writable-overlay preparation run in owned worker processes. Stopping or deleting a sandbox cancels its worker and formatter processes, waits for them to exit, then removes the attempt's temporary files under `<state-dir>/images/preparations/`. New overlays, including retries after an interrupted first start, are built there and renamed into sandbox state only after completion. A file lock inherited by the worker's children keeps cleanup from deleting files that a process still owns. If cleanup cannot establish that the processes have stopped, the operation returns an error and retains both temporary files and sandbox state.
223+
224+
At startup, the driver reclaims inactive attempts in this directory. It preserves active attempts, committed image caches, and unmarked staging from older releases. Concurrent preparations serialize image-cache publication; an interrupted attempt cannot publish a partial disk over an existing cache entry. Gateway upload slots for `rootfs_tar_path` keep their existing, separate lifecycle.
225+
222226
Each sandbox gets its own sparse writable
223227
`<state-dir>/sandboxes/<id>/overlay.ext4`. Guest init mounts overlayfs as `/`
224228
with the prepared image rootfs as lowerdir when present, otherwise the bootstrap

0 commit comments

Comments
 (0)