Conversation
benoitf
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
September 18, 2026 15:21
2 tasks done
|
Confirming from the requester side: this matches what we asked for in #1509 — opt-in volume mounts for MicroVM sandboxes. The core ask there was the ability to add virtiofs devices beyond the rootfs in a libkrun VM, behind an explicit operator opt-in, with the guest-side mount handled during the driver's boot sequence. That's what this implements. Thanks for picking it up. |
benoitf
force-pushed
the
feat/vm-bind-mounts
branch
from
September 23, 2026 08:21
d7236e6 to
3c81133
Compare
Contributor
Author
|
I rebased the PR on top of the main branch due to conflicts |
benoitf
force-pushed
the
feat/vm-bind-mounts
branch
3 times, most recently
from
September 28, 2026 08:13
bd1d7b2 to
135f022
Compare
Contributor
Author
|
rebased and added e2e tests |
Introduce host directory bind mounts for libkrun VM sandboxes using the virtiofs4 API with simplified permission semantics. The gateway accepts `enable_bind_mounts` in the `[openshell.drivers.vm]` TOML table and forwards it to the VM driver subprocess. Mounts are specified per-sandbox in driver_config.mounts[] with source, target, optional read_only (default: read-only), and an optional `type` that must be `bind`, so Docker and Podman bind entries parse unchanged. At sandbox validation the driver rejects mounts unless bind mounts are enabled and resource admission is disabled, and checks targets against reserved VM-internal directories and each other (no nested targets). Host source directories are checked at provisioning, so a briefly missing source fails provisioning visibly instead of denying recovery of a persisted sandbox. The driver generates virtiofs tags and always writes a guest-side manifest into the overlay disk, so an image-supplied manifest can never drive guest mounts. Guest init mounts the shares after every /sandbox ownership fixup and the init drop-ins, so recursive chowns never reach host files. It refuses targets that traverse symlinks in the image and hands newly created mount point parents under /sandbox to the sandbox user. krun_add_virtiofs4 is resolved optionally, so older libkrun runtimes still boot sandboxes without mounts. Kernel config adds CONFIG_FUSE_FS and CONFIG_VIRTIO_FS to support the virtiofs filesystem in the guest. A vm_bind_mount e2e test checks a read-write share round-trips data with the host and a read-only share rejects writes; the VM e2e gateway enables bind mounts like the Docker and Podman e2e gateways. Signed-off-by: Florent Benoit <fbenoit@redhat.com>
benoitf
force-pushed
the
feat/vm-bind-mounts
branch
from
October 1, 2026 08:14
135f022 to
606a784
Compare
Contributor
Author
|
rebased to fix conflict |
This branch has not been deployed
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.
Summary
Add host directory bind mount support for libkrun VM sandboxes via the virtiofs4 API with simplified permission semantics. Operators enable the feature with
enable_bind_mounts = truein[openshell.drivers.vm], and sandbox creators specify mounts indriver_config.mounts[].note: it depends on a new release of kernel published at https://github.com/NVIDIA/OpenShell/actions/workflows/release-vm-kernel.yml for pre-built vm (with newer libkrun)
Related Issue
#2585
Changes
openshell-gateway): Acceptenable_bind_mountsinVmComputeConfigand forward as--enable-bind-mountsCLI flag to the VM driver subprocessopenshell-driver-vm): Addkrun_add_virtiofs4binding (6-arg: ctx, tag, path, shm_size, read_only, semantics)openshell-driver-vm): NewVmMounttype andadd_virtiofs()method calling virtiofs4 withSEMANTICS_SIMPLIFIEDopenshell-driver-vm):VmMountConfigdeserialization, path validation against reserved VM-internal directories, virtiofs tag generation, guest mount manifest injection into overlay disk,--vm-mountCLI arg forwardingmount_virtiofs_shares()reads/.openshell/mounts.manifestand mounts virtiofs shares at bootCONFIG_FUSE_FSandCONFIG_VIRTIO_FSfor guest virtiofs supportenable_bind_mountstogateway-config.mdxreferenceTesting
enable_bind_mounts, rejects QEMU, rejects relative source, rejects file source, rejects reserved paths, rejects duplicates)--vm-mountCLI arg parsingdriver_config.mountsand verify host directory is accessible in guestChecklist
gateway-config.mdx)mise run pre-commitpassesmise run testpasses