Skip to content

fix(deploy/sbx): refuse a workspace image larger than the snapshot's 2 GiB drive (#907) - #915

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/workspace-image-snapshot-cap
Nov 19, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/workspace-image-snapshot-cap

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

Refuses a workspace image larger than the golden snapshot's 2 GiB workspace drive, before anything is applied or installed. Refs #907 (this is the guard; building the snapshot's drive at the configured size stays open there).

Why: a Firecracker guest restored from the golden snapshot keeps the workspace drive size recorded in its vmstate. That size is deploy/microvm/build-snapshot.sh's WORKSPACE_IMAGE_BYTES, fixed at 2 GiB. A larger workspace image cannot be mounted: the worker's startup probe fails (mount /workspace exited 32) and the worker never attaches. E17b hit this with a 4096 MiB workspace.

Changes

  • deploy/sbx/setup.sh: SNAPSHOT_WORKSPACE_MB=2048. SBX_WORKSPACE_IMAGE_MB above it is refused with an error that names the drive, the script it comes from and microvm-worker: SH_WORKSPACE_IMAGE_MB above the snapshot's 2 GiB workspace drive leaves the worker unattached (mount /workspace exited 32) #907.
  • deploy/sbx/install-host.sh: the same cap on the bundle's SH_WORKSPACE_IMAGE_MB.
  • deploy/sbx/README.md: the SBX_WORKSPACE_IMAGE_MB row says "at most 2048".
  • Tests:
    • setup.test.sh refuses 2049.
    • install-host.test.sh refuses 2049.
    • A new check pins both scripts' SNAPSHOT_WORKSPACE_MB to build-snapshot.sh's WORKSPACE_IMAGE_BYTES, so changing one without the others fails.
    • The install test's py312 bundle moves from 4096 to 1536 MiB. It only needed a non-default size.

Defaults are unchanged (2048), so no deployed host is affected.

Tests

  • deploy/sbx/tests/setup.test.sh and deploy/sbx/tests/install-host.test.sh: pass under bash 5 and macOS bash 3.2 (71 checks each under 3.2).
  • shellcheck -x -S warning (the repo gate) is clean on the four changed scripts.
  • Prettier 3.10.1 --check is clean on the README.

Assisted-By: Claude Code

…2 GiB drive (rossoctl#907)

A Firecracker guest restored from the golden snapshot keeps the workspace
drive size its vmstate recorded (deploy/microvm/build-snapshot.sh
WORKSPACE_IMAGE_BYTES, 2 GiB), so a larger workspace image cannot be
mounted: the worker's startup probe fails ('mount /workspace exited 32')
and the worker never attaches. setup.sh refuses SBX_WORKSPACE_IMAGE_MB and
install-host.sh refuses SH_WORKSPACE_IMAGE_MB above SNAPSHOT_WORKSPACE_MB
(2048), naming the cause; a test pins both to build-snapshot.sh's value.
The install test's py312 bundle moves from 4096 to 1536 MiB.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — fix(deploy/sbx): refuse a workspace image larger than the snapshot's drive (#907)

Caps the operator's workspace image size at the golden snapshot's workspace drive, in both places that accept it.

Verified

  • The constant is the snapshot's: deploy/microvm/build-snapshot.sh:1483 is WORKSPACE_IMAGE_BYTES=$((2 * 1024 * 1024 * 1024)), i.e. 2048 MiB, which is exactly SNAPSHOT_WORKSPACE_MB in setup.sh:180 and install-host.sh:146.
  • Both refusals sit after the numeric check and before anything is applied: setup.sh:284-288 validates the COUNT6_RE set first, then the cap, then the disk-budget check at :293; install-host.sh:723-725 does the value check first, then the cap, in validate_worker. So a malformed value still gets its own message, 2049 gets the cap message, and the existing 999999999 cases still hit the six-digit error.
  • Defaults still pass: the shipped default is 2048 and ((2048 <= 2048)) is true, so no existing valid configuration is refused; nothing in the tree configures a larger value (the only >2048 numbers left are the deliberate test inputs).
  • The arithmetic is safe: both regexes forbid a leading zero, so ((…)) cannot read the value as octal, and the || die form keeps set -e from exiting without the message.
  • Tests: both scripts get a 2049 refusal case (setup.test.sh:236, install-host.test.sh:91), and setup.test.sh:268-277 pins both SNAPSHOT_WORKSPACE_MB constants to build-snapshot.sh's WORKSPACE_IMAGE_BYTES by parsing it (the sed matches line 1483's exact form), so bumping one without the others fails. The py312 bundle dropping 4096 → 1536 is what makes that fixture legal.
  • Docs: the SBX_WORKSPACE_IMAGE_MB row in deploy/sbx/README.md states the 2048 maximum and why.

CI: 16/16 green. No inline comments.

Author: pdettori (MEMBER — maintainer). Agent/IDE config: none. Commits: 1, signed off.

@pdettori
pdettori merged commit 257ec99 into rossoctl:main Nov 19, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants