Skip to content

Commit

Permalink
kubevirt: Ignore completed virt-launcher pods
Browse files Browse the repository at this point in the history
When a live migration fails at completed virt-launcher pod with newer
creation timestamp is lingering in the system so the virt-launcher that
is really running the VM is hidden by it and routes are wrongly
reconstructed. This change take into account if the pod is completed to
ignore it marking it as stale.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
  • Loading branch information
qinqon committed Oct 31, 2023
1 parent 89c7f68 commit 04a5f25
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions go-controller/pkg/kubevirt/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,18 @@ func EnsurePodAnnotationForVM(watchFactory *factory.WatchFactory, kube *kube.Kub
return podAnnotation, nil
}

// IsMigratedSourcePodStale return true if there are other pods related to
// to it and any of them has newer creation timestamp.
// IsMigratedSourcePodStale return false is the pod is live migratable and not completed
// and is the running vm pod with newest creation timestamp
func IsMigratedSourcePodStale(client *factory.WatchFactory, pod *corev1.Pod) (bool, error) {
if util.PodCompleted(pod) {
return true, nil
}
if !IsPodLiveMigratable(pod) {
return false, nil
return true, nil
}
vmPods, err := findVMRelatedPods(client, pod)
if err != nil {
return false, fmt.Errorf("failed finding related pods for pod %s/%s when checking live migration left overs: %v", pod.Namespace, pod.Name, err)
return true, fmt.Errorf("failed finding related pods for pod %s/%s when checking live migration left overs: %v", pod.Namespace, pod.Name, err)
}

for _, vmPod := range vmPods {
Expand Down

0 comments on commit 04a5f25

Please sign in to comment.