From 6a5ec397b92346c5a1821b9f2a9e5bb24e18c3af Mon Sep 17 00:00:00 2001 From: Melvin Hillsman Date: Thu, 28 May 2026 10:05:04 -0500 Subject: [PATCH] fix(run): warn when VM remainder is truncated in multi-role distribution Integer division `vmCount / len(roles)` silently dropped remainder VMs. Add a warning log with requested count, per-role count, and number of dropped VMs so the truncation is visible to operators. Resolves #107 Signed-off-by: Melvin Hillsman --- cmd/virtwork/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/virtwork/main.go b/cmd/virtwork/main.go index f17808c..a85d8a1 100644 --- a/cmd/virtwork/main.go +++ b/cmd/virtwork/main.go @@ -327,6 +327,13 @@ func runE(cmd *cobra.Command, args []string) error { // Multi-VM workload — use UserdataForRole roles := multiVM.Roles() perRole := vmCount / len(roles) + if remainder := vmCount % len(roles); remainder != 0 { + logger.Warn("VM count not evenly divisible by roles; remainder VMs will not be created", + slog.String("workload", name), + slog.Int("requested", vmCount), + slog.Int("per_role", perRole), + slog.Int("dropped", remainder)) + } for _, role := range roles { userdata, err := multiVM.UserdataForRole(role, cfg.Namespace) if err != nil {