Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,29 @@ func isPodPendingUnschedulable(pod *corev1.Pod) bool {
return false
}

func (h LifecycleHandler) getConditionCompletedMessageByReason(ctx context.Context, reason vmopcondition.ReasonCompleted, mig *virtv1.VirtualMachineInstanceMigration) (string, error) {
msg := "Wait until operation is completed"
if reason == vmopcondition.ReasonMigrationPending || reason == vmopcondition.ReasonMigrationPrepareTarget {
func (h LifecycleHandler) getConditionCompletedMessageByReason(
ctx context.Context,
reason vmopcondition.ReasonCompleted,
mig *virtv1.VirtualMachineInstanceMigration,
) (string, error) {
switch reason {
case vmopcondition.ReasonMigrationPending:
return "The VirtualMachineOperation for migrating the virtual machine has been queued. " +
"Waiting for the queue to be processed and for this operation to be executed.", nil

case vmopcondition.ReasonMigrationPrepareTarget:
pod, err := h.getTargetPod(ctx, mig)
if err != nil {
return "", err
}

if isPodPendingUnschedulable(pod) {
msg += fmt.Sprintf(" (target pod is unschedulable: %s/%s)", pod.Namespace, pod.Name)
return fmt.Sprintf("Waiting for the virtual machine to be scheduled: "+
"target pod \"%s/%s\" is unschedulable.", pod.Namespace, pod.Name), nil
}
return "The target environment is in the process of being prepared for migration.", nil

default:
return "Wait until operation is completed.", nil
}
return msg + ".", nil
}
Loading