From 987be2725692f6ea8e67a09547bacf7564d227e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Poyraz=20K=C3=BC=C3=A7=C3=BCkarslan?= <83272398+PoyrazK@users.noreply.github.com> Date: Thu, 7 May 2026 21:30:04 +0300 Subject: [PATCH] fix: libvirt instance rm error message - use backend type instead of "container" Follows the same pattern as PR #484 (StopInstance fix for #430). The removeInstanceContainer error now says "failed to remove {backend} instance" instead of hardcoded "failed to remove container". Fixes #435 --- internal/core/services/instance.go | 4 ++-- internal/core/services/instance_unit_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/core/services/instance.go b/internal/core/services/instance.go index 298a7b28..b1e10180 100644 --- a/internal/core/services/instance.go +++ b/internal/core/services/instance.go @@ -1219,8 +1219,8 @@ func (s *InstanceService) removeInstanceContainer(ctx context.Context, inst *dom } if err := s.compute.DeleteInstance(ctx, containerID); err != nil { - s.logger.Warn("failed to remove docker container", "container_id", containerID, "error", err) - return errors.Wrap(errors.Internal, "failed to remove container", err) + s.logger.Warn("failed to remove instance", "backend", s.compute.Type(), "id", containerID, "error", err) + return errors.Wrap(errors.Internal, fmt.Sprintf("failed to remove %s instance", s.compute.Type()), err) } s.logger.Info("instance terminated", "instance_id", inst.ID) diff --git a/internal/core/services/instance_unit_test.go b/internal/core/services/instance_unit_test.go index 4f4dc96d..966b1a4f 100644 --- a/internal/core/services/instance_unit_test.go +++ b/internal/core/services/instance_unit_test.go @@ -823,7 +823,7 @@ func testInstanceServiceTerminateUnit(t *testing.T) { err := svc.TerminateInstance(ctx, instanceID.String()) require.Error(t, err) - assert.Contains(t, err.Error(), "failed to remove container") + assert.Contains(t, err.Error(), "failed to remove docker instance") mock.AssertExpectationsForObjects(t, repo, rbacSvc, compute) })