Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debos: Warn if parsed memory/scratchsize may be too small #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 13 additions & 3 deletions cmd/debos/debos.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func main() {
TemplateVars map[string]string `short:"t" long:"template-var" description:"Template variables (use -t VARIABLE:VALUE syntax)"`
DebugShell bool `long:"debug-shell" description:"Fall into interactive shell on error"`
Shell string `short:"s" long:"shell" description:"Redefine interactive shell binary (default: bash)" optionsl:"" default:"/bin/bash"`
ScratchSize string `long:"scratchsize" description:"Size of disk backed scratch space"`
ScratchSize string `long:"scratchsize" description:"Size of disk-backed scratch space (parsed with human-readable suffix; assumed bytes if no suffix)"`
CPUs int `short:"c" long:"cpus" description:"Number of CPUs to use for build VM (default: 2)"`
Memory string `short:"m" long:"memory" description:"Amount of memory for build VM (default: 2048MB)"`
Memory string `short:"m" long:"memory" description:"Amount of memory for build VM (parsed with human-readable suffix; assumed bytes if no suffix. default: 2048MB)"`
ShowBoot bool `long:"show-boot" description:"Show boot/console messages from the fake machine"`
EnvironVars map[string]string `short:"e" long:"environ-var" description:"Environment variables (use -e VARIABLE:VALUE syntax)"`
Verbose bool `short:"v" long:"verbose" description:"Verbose output"`
Expand Down Expand Up @@ -257,7 +257,12 @@ func main() {
exitcode = 1
return
}
m.SetMemory(int(memsize / 1024 / 1024))

memsizeMB := int(memsize / 1024 / 1024)
if memsizeMB < 2048 {
log.Printf("WARNING: Memory size of %dMB is less than recommended 2048MB\n", memsizeMB)
}
m.SetMemory(memsizeMB)

if options.CPUs == 0 {
// Set default CPU count for fakemachine
Expand All @@ -272,6 +277,11 @@ func main() {
exitcode = 1
return
}

scratchsizeMB := int(size / 1024 / 1024)
if scratchsizeMB < 2048 {
log.Printf("WARNING: Scratch size of %dMB is less than recommended 2048MB\n", scratchsizeMB)
}
m.SetScratch(size, "")
}

Expand Down