Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 58 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ The guest has no network device.
## The vendored driver

`vendor/openshell` holds one crate: OpenShell's VM driver (`openshell-driver-vm`), taken from
NVIDIA/OpenShell `main` at commit `f16795b` (after `v0.1.9`; not a release; pinned in [`driver/UPSTREAM.env`](driver/UPSTREAM.env)) and
trimmed. It is its own cargo workspace. The other OpenShell crates it uses (`openshell-core`
the `patched` branch of the fork [mr-miles/OpenShell](https://github.com/mr-miles/OpenShell) at commit
`4a1528b` (pinned in [`driver/UPSTREAM.env`](driver/UPSTREAM.env)) and trimmed. That branch is OpenShell
release `v0.1.11` plus fixes not yet merged upstream: the L7
proxy keeps percent-encoded path bytes and signs S3 paths as AWS does, and the VM driver
perf changes of ai-openshell/openshell#6056 and #6057 (fewer `debugfs` runs, hashes and worker
processes per launch), and the shared supervisor host over Unix sockets that the driver's
[shared supervisor](#shared-supervisor) needs. It is its own cargo workspace. The other OpenShell crates it uses (`openshell-core`
and friends) are **git dependencies on the same commit**, not copies, so building needs
network access to GitHub. The changes from upstream are listed in
[its README](vendor/openshell/crates/openshell-driver-vm/README.md): image `ENV` and
Expand All @@ -61,9 +66,10 @@ pinned commit when a release is made. `mise run driver:check-pin` fails if the r
### Compatibility

The supervisor protocol is not stable across OpenShell revisions, so the gateway must come
from a revision compatible with the one in `driver/UPSTREAM.env`, currently `main`
at `f16795b`, which is not a release: build the gateway from that commit. Released gateways,
`v0.1.9` included, have not been checked against it. `install.sh` prints
from a revision compatible with the one in `driver/UPSTREAM.env`, currently the fork's `patched`
branch at `4a1528b`, which is not a release: build the gateway from that commit (or use the
`v0.1.11` release, its base; the stack changes no gateway protocol). Older released gateways,
`v0.1.10` included, have not been checked against it. `install.sh` prints
the commit the installed driver was built from and the gateway's reported version, and leaves
the comparison to you.

Expand Down Expand Up @@ -436,6 +442,8 @@ The driver's `OPENSHELL_VM_DEFAULT_WORKDIR` (default `/sandbox`) sets the workin
sandboxes whose image has none ([Image ENV and WORKDIR](#image-env-and-workdir)).
The driver's `OPENSHELL_VM_SUPERVISOR_IDENTITY*` options (optional, off by default) are in
[Supervisor identity](#supervisor-identity).
The driver's `OPENSHELL_VM_SHARED_SUPERVISOR` (default `false`) runs one host supervisor for
every sandbox; see [Shared supervisor](#shared-supervisor).
The driver's `OPENSHELL_VM_MAX_VCPUS` and `OPENSHELL_VM_MAX_MEM_MIB` limit what a sandbox can request
with `--cpu` and `--memory`, and `OPENSHELL_VM_MAX_OVERLAY_DISK_MIB`, `OPENSHELL_VM_FILES_ROOT` and
`OPENSHELL_VM_FILES_MAX_BYTES` what it can request in its `driver_config`; see
Expand Down Expand Up @@ -733,13 +741,56 @@ Limits:
- This is not SPIRE. There is one trust domain, no federation, no X.509 SVIDs, and the
attestation knows only the supervisor processes this driver started.

## Shared supervisor

By default every sandbox gets its own host supervisor process, as upstream. Set
`OPENSHELL_VM_SHARED_SUPERVISOR=true` in the driver's environment to run one supervisor for
every sandbox on the host instead. This saves one supervisor's memory per sandbox. It is
experimental and off by default.

The gateway needs no change: it sees the same per-sandbox supervisor sessions as with dedicated
supervisors. OpenShell's own shared supervisor topology is Kubernetes-only, because the gateway
hands out sandboxes only to an in-process driver. So here the driver does that part itself:

- On the first launch, the driver starts `openshell-supervisor --mode=shared` and serves the
supervisor's private assignment stream on a Unix socket in its private socket directory. It
accepts only its own uid and a token it mints and renews in a file. The supervisor dials the
gateway itself for every sandbox session, with the gateway's CA (`guest_tls_ca`) when the
gateway uses TLS.
- Each launch hands the supervisor that generation's launch credentials (the ones a dedicated
supervisor receives). The supervisor listens on the VM's control socket while it hosts the
sandbox, as a dedicated supervisor does, so the guest side is unchanged.
- Stopping a sandbox asks the supervisor to stop it and waits until the supervisor lets go of
it, which removes the control socket, or until the usual shutdown grace runs out. Then it
stops the VM.

This needs a supervisor that can dial a `unix:` assignment endpoint and serve a sandbox on its
own socket. Those changes are not upstream yet (fork branch
`feat/shared-host-unix/mr-miles`). Without them every launch with the shared supervisor
fails, so leave it off unless the pinned OpenShell revision includes them.

Limits:

- **No failover.** Moving a running sandbox to another supervisor needs a takeover grant signed
by the gateway. If the shared supervisor exits, every VM it supervised fails with
`ProcessExited`, as one would whose dedicated supervisor exited. The driver starts a new
supervisor for later launches.
- At most 256 sandboxes per driver.
- It cannot be combined with supervisor identity (`OPENSHELL_VM_SUPERVISOR_IDENTITY`), the
network supervisor additional CA, or an upstream proxy. The driver refuses to start with
any of them.
- Agent traces are not relayed: the upstream shared supervisor has no per-sandbox collector yet.
- Its logs and token are under `<state dir>/shared-supervisor/`: `supervisor.log`,
`supervisor.err.log` and `token`.

## What does not work

- No virtiofs bind mounts and no GPU passthrough on Firecracker. A sandbox that asks for
either is rejected at validation, not ignored. To get host files into a guest, use
[`driver_config.files`](#per-sandbox-cpu-memory-disk-size-and-files), which copies them in.
- `[openshell.supervisor.network].additional_ca_bundle` and the shared supervisor pool
are rejected by the gateway for any external driver.
- `[openshell.supervisor.network].additional_ca_bundle` and the gateway's shared supervisor
pool are rejected by the gateway for any external driver. The driver has its own
[shared supervisor](#shared-supervisor).
- Rootfs tar uploads need the driver and gateway on the same filesystem and UID.
- `openshell-gateway config preflight` skips host-tool checks for an external driver;
`openshell-firecracker-launcher check` covers the Firecracker ones.
Expand Down
4 changes: 2 additions & 2 deletions driver/UPSTREAM.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# protocol is not stable across revisions. To move to another revision, re-vendor the
# driver crate from it (see crates/openshell-driver-vm/README.md), then change the commit here
# and the `rev` in vendor/openshell/Cargo.toml.
OPENSHELL_REPO=https://github.com/NVIDIA/OpenShell
OPENSHELL_COMMIT=f16795bc76b13fcc35d8b0d2b49cfc788c701ef9
OPENSHELL_REPO=https://github.com/mr-miles/OpenShell
OPENSHELL_COMMIT=4a1528b14904f9c41bbde149ff3a2c87d467eae9
OPENSHELL_TAG=

# Optional: build the embedded runtime (host supervisor, guest sandbox, guest init) from
Expand Down
Loading