Bug Description
internal/vm/vm.go uses resource.MustParse() in two places (lines 125 and 170) to parse user-supplied memory and disk-size strings. MustParse panics instead of returning an error when the input is malformed. A CLI tool should never panic on bad user input — it should return a clear error message.
Steps to Reproduce
- Run
virtwork run --workloads cpu --memory "not-a-quantity"
- Observe a panic/stack trace instead of a user-friendly error
Expected Behavior
virtwork prints a clear error message like invalid memory value "not-a-quantity": ... and exits with a non-zero status code.
Actual Behavior
The process panics with an unrecoverable stack trace from resource.MustParse.
Affected Code
internal/vm/vm.go:125 — resource.MustParse(opts.Memory)
internal/vm/vm.go:170 — resource.MustParse(size) for data disk
Command
Workload Type
- Not applicable (affects all workloads)
Proposed Fix
Replace resource.MustParse() with resource.ParseQuantity() which returns (Quantity, error). Propagate the error up through BuildVM / buildDataVolume to the caller.
Bug Description
internal/vm/vm.gousesresource.MustParse()in two places (lines 125 and 170) to parse user-supplied memory and disk-size strings.MustParsepanics instead of returning an error when the input is malformed. A CLI tool should never panic on bad user input — it should return a clear error message.Steps to Reproduce
virtwork run --workloads cpu --memory "not-a-quantity"Expected Behavior
virtwork prints a clear error message like
invalid memory value "not-a-quantity": ...and exits with a non-zero status code.Actual Behavior
The process panics with an unrecoverable stack trace from
resource.MustParse.Affected Code
internal/vm/vm.go:125—resource.MustParse(opts.Memory)internal/vm/vm.go:170—resource.MustParse(size)for data diskCommand
Workload Type
Proposed Fix
Replace
resource.MustParse()withresource.ParseQuantity()which returns(Quantity, error). Propagate the error up throughBuildVM/buildDataVolumeto the caller.