Bug Description
In cmd/virtwork/main.go:352, multi-VM workloads distribute VMs across roles using integer division:
perRole := vmCount / len(roles)
When vmCount is not evenly divisible by the number of roles, the remainder VMs are silently dropped. For example, with vm-count=5 and 2 roles (server/client), only 4 VMs are created (2 per role) — the 5th VM vanishes with no warning, log message, or audit record.
This is particularly confusing because the audit event at line 408 reports the planned count (5), while the actual count is 4.
Steps to Reproduce
- Run
virtwork run --workloads tps --vm-count 5
- TPS has 2 roles (server, client), so
perRole = 5 / 2 = 2
- Only 4 VMs are created (2 servers + 2 clients)
- The deployment summary reports 4 VMs but the user requested 5
Expected Behavior
Either:
- Return an error if
vmCount is not evenly divisible by the number of roles
- Distribute remainder VMs across roles (e.g., 3 servers + 2 clients for vm-count=5)
- Log a warning explaining that the count was adjusted and why
Actual Behavior
The remainder is silently truncated. No warning, no error, no audit record. The user sees fewer VMs than requested with no explanation.
Command
virtwork run
Affected Files
cmd/virtwork/main.go:352 — perRole := vmCount / len(roles) truncates silently
Bug Description
In
cmd/virtwork/main.go:352, multi-VM workloads distribute VMs across roles using integer division:When
vmCountis not evenly divisible by the number of roles, the remainder VMs are silently dropped. For example, withvm-count=5and 2 roles (server/client), only 4 VMs are created (2 per role) — the 5th VM vanishes with no warning, log message, or audit record.This is particularly confusing because the audit event at line 408 reports the planned count (5), while the actual count is 4.
Steps to Reproduce
virtwork run --workloads tps --vm-count 5perRole = 5 / 2 = 2Expected Behavior
Either:
vmCountis not evenly divisible by the number of rolesActual Behavior
The remainder is silently truncated. No warning, no error, no audit record. The user sees fewer VMs than requested with no explanation.
Command
virtwork run
Affected Files
cmd/virtwork/main.go:352—perRole := vmCount / len(roles)truncates silently