From e7786d10a694759d5e029e2621c5b73678e3d071 Mon Sep 17 00:00:00 2001 From: Yaroslav Borbat <86148689+yaroslavborbat@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:05:40 +0300 Subject: [PATCH] fix(vmop): fix panic if VM is not exist (#129) Description Fix panic in UpdateStatus for non existing VM Signed-off-by: yaroslavborbat (cherry picked from commit 9b906410a0fd0c85983fa58cc2b3a079cdbb4403) --- .../pkg/controller/vmop/vmop_reconciler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/virtualization-artifact/pkg/controller/vmop/vmop_reconciler.go b/images/virtualization-artifact/pkg/controller/vmop/vmop_reconciler.go index d544ca730..4dd97b416 100644 --- a/images/virtualization-artifact/pkg/controller/vmop/vmop_reconciler.go +++ b/images/virtualization-artifact/pkg/controller/vmop/vmop_reconciler.go @@ -169,7 +169,7 @@ func (r *Reconciler) UpdateStatus(_ context.Context, _ reconcile.Request, state vmopStatus.FailureMessage = result.Message() } } - if state.IsInProgress() && r.IsCompleted(state.VMOP.Current().Spec.Type, state.VM.Status.Phase) { + if !state.VmIsEmpty() && state.IsInProgress() && r.IsCompleted(state.VMOP.Current().Spec.Type, state.VM.Status.Phase) { vmopStatus.Phase = virtv2.VMOPPhaseCompleted } state.VMOP.Changed().Status = *vmopStatus