Skip to content

Add configurable /tmp tmpfs size for guest VMs#44

Merged
JAORMX merged 2 commits intomainfrom
feat/configurable-tmp-size
Mar 16, 2026
Merged

Add configurable /tmp tmpfs size for guest VMs#44
JAORMX merged 2 commits intomainfrom
feat/configurable-tmp-size

Conversation

@JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Mar 16, 2026

Summary

  • Add WithTmpSize(mib uint32) option to set the /tmp tmpfs size inside guest VMs
  • Host writes the value to /etc/propolis-vm.json via hooks.InjectVMConfig; guest reads it via new guest/vmconfig package before mounting filesystems
  • When unset, the existing 256 MiB default is preserved (backward compatible)

Changes

  • options.go / propolis.go: New WithTmpSize host-side option + injection in Run()
  • hooks/hooks.go: VMConfig type and InjectVMConfig hook that writes JSON config to rootfs
  • guest/vmconfig/: New package — reads /etc/propolis-vm.json from guest side, returns zero-value Config if file absent
  • guest/boot/options.go: New WithTmpSize boot option for guest init
  • guest/mount/mount.go: Essential() accepts tmpSizeMiB parameter
  • guest/mount/mount_test.go: Updated tests + new TestEssentialTmpSizeDefault

Test plan

  • task test-nocgo passes
  • task lint clean (0 issues)
  • Integration test with consumer (brood-box) using replace directive

🤖 Generated with Claude Code

JAORMX and others added 2 commits March 16, 2026 13:05
Allow callers to set the /tmp tmpfs size via WithTmpSize(mib).
The host writes the value to /etc/propolis-vm.json in the rootfs
using InjectVMConfig, and the guest init reads it via the new
guest/vmconfig package before mounting filesystems. When unset,
the existing 256 MiB default is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove duplicate VMConfig struct and path constant from hooks package
by importing guest/vmconfig directly. Extract essentialMounts() from
Essential() so mount tests exercise real production code instead of
hand-constructed literals. Add table-driven tests for vmconfig.Read()
and hooks.InjectVMConfig. Improve WithTmpSize godoc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

Review comment posted inline — see below.

JAORMX added a commit to stacklok/brood-box that referenced this pull request Mar 16, 2026
Wire propolis WithTmpSize through all layers so users can configure
the guest /tmp tmpfs size. Introduces a ByteSize type in the config
domain that accepts "512m", "2g", or bare integers (MiB) in YAML.

- New ByteSize type with encoding.TextUnmarshaler for yaml.v3
- DefaultsConfig and AgentOverride use ByteSize for tmp_size
- bbox-init reads vmconfig and passes TmpSize to guest boot
- VMConfig, RunOpts, and PropolisRunner pass TmpSizeMiB through

Depends on stacklok/go-microvm#44 (go.mod replace is temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX merged commit 0f8c850 into main Mar 16, 2026
7 checks passed
@JAORMX JAORMX deleted the feat/configurable-tmp-size branch March 16, 2026 14:20
JAORMX added a commit to stacklok/brood-box that referenced this pull request Mar 16, 2026
Wire propolis WithTmpSize through all layers so users can configure
the guest /tmp tmpfs size. Introduces a ByteSize type in the config
domain that accepts "512m", "2g", or bare integers (MiB) in YAML.

- New ByteSize type with encoding.TextUnmarshaler for yaml.v3
- DefaultsConfig and AgentOverride use ByteSize for tmp_size
- bbox-init reads vmconfig and passes TmpSize to guest boot
- VMConfig, RunOpts, and PropolisRunner pass TmpSizeMiB through

Depends on stacklok/go-microvm#44 (go.mod replace is temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
JAORMX added a commit to stacklok/brood-box that referenced this pull request Mar 16, 2026
Wire propolis WithTmpSize through all layers so users can configure
the guest /tmp tmpfs size. Introduces a ByteSize type in the config
domain that accepts "512m", "2g", or bare integers (MiB) in YAML.

- New ByteSize type with encoding.TextUnmarshaler for yaml.v3
- DefaultsConfig and AgentOverride use ByteSize for tmp_size
- bbox-init reads vmconfig and passes TmpSize to guest boot
- VMConfig, RunOpts, and PropolisRunner pass TmpSizeMiB through

Depends on stacklok/go-microvm#44 (go.mod replace is temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
JAORMX added a commit to stacklok/brood-box that referenced this pull request Mar 16, 2026
* Add configurable /tmp tmpfs size with human-readable ByteSize

Wire propolis WithTmpSize through all layers so users can configure
the guest /tmp tmpfs size. Introduces a ByteSize type in the config
domain that accepts "512m", "2g", or bare integers (MiB) in YAML.

- New ByteSize type with encoding.TextUnmarshaler for yaml.v3
- DefaultsConfig and AgentOverride use ByteSize for tmp_size
- bbox-init reads vmconfig and passes TmpSize to guest boot
- VMConfig, RunOpts, and PropolisRunner pass TmpSizeMiB through

Depends on stacklok/go-microvm#44 (go.mod replace is temporary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>

* Set default /tmp tmpfs to 512 MiB for all built-in agents

Also pin gvisor.dev/gvisor to the version propolis v0.0.21
actually requires, fixing a broken templated assembly file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address PR review feedback for configurable tmp size

- Fix uint64 overflow in ByteSize GiB parsing (silent wraparound)
- Make workspace-local TmpSize tighten-only (cannot inflate beyond global)
- Add explicit vmconfig fallback in bbox-init for future-proofing
- Add --tmp-size CLI flag (parity with --cpus and --memory)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants