Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Khorunzhin <[email protected]>
  • Loading branch information
Valeriy Khorunzhin committed Dec 16, 2024
1 parent c014fdc commit 50e54fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (h *LifeCycleHandler) syncPodStarted(vm *virtv2.VirtualMachine, kvvm *virtv
}

// Try to extract error from kvvm Synchronized condition.
if isPodStartedError(kvvm.Status.PrintableStatus) {
if isPodStartedError(kvvm) {
msg := fmt.Sprintf("Failed to start pod: %s", kvvm.Status.PrintableStatus)
if kvvmi != nil {
msg = fmt.Sprintf("%s, %s", msg, kvvmi.Status.Phase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,16 @@ var mapReasons = map[string]vmcondition.Reason{
virtv1.GuestNotRunningReason: vmcondition.ReasonGuestNotRunningReason,
}

func isPodStartedError(phase virtv1.VirtualMachinePrintableStatus) bool {
func isPodStartedError(vm *virtv1.VirtualMachine) bool {
const failedCreatePodReason = "FailedCreate"
synchronized := service.GetKVVMCondition(string(virtv1.VirtualMachineInstanceSynchronized), vm.Status.Conditions)
if synchronized != nil &&
synchronized.Status == corev1.ConditionFalse &&
synchronized.Reason == failedCreatePodReason {
return true
}

phase := vm.Status.PrintableStatus
return slices.Contains([]virtv1.VirtualMachinePrintableStatus{
virtv1.VirtualMachineStatusErrImagePull,
virtv1.VirtualMachineStatusImagePullBackOff,
Expand Down

0 comments on commit 50e54fb

Please sign in to comment.