Add configurable /tmp tmpfs size for guest VMs#44
Merged
Conversation
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>
jhrozek
reviewed
Mar 16, 2026
Contributor
jhrozek
left a comment
There was a problem hiding this comment.
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>
2 tasks
jhrozek
approved these changes
Mar 16, 2026
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>
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
WithTmpSize(mib uint32)option to set the/tmptmpfs size inside guest VMs/etc/propolis-vm.jsonviahooks.InjectVMConfig; guest reads it via newguest/vmconfigpackage before mounting filesystemsChanges
options.go/propolis.go: NewWithTmpSizehost-side option + injection inRun()hooks/hooks.go:VMConfigtype andInjectVMConfighook that writes JSON config to rootfsguest/vmconfig/: New package — reads/etc/propolis-vm.jsonfrom guest side, returns zero-valueConfigif file absentguest/boot/options.go: NewWithTmpSizeboot option for guest initguest/mount/mount.go:Essential()acceptstmpSizeMiBparameterguest/mount/mount_test.go: Updated tests + newTestEssentialTmpSizeDefaultTest plan
task test-nocgopassestask lintclean (0 issues)replacedirective🤖 Generated with Claude Code