Commit 72a6520
committed
fix: prevent GC from deleting KubeVirt VM interfaces
The garbage collector introduced in PR kubeovn#5789 incorrectly identifies
KubeVirt VM interfaces as 'lost' and deletes them, breaking network
connectivity for VMs within ~60 seconds of creation.
Root cause: For KubeVirt VMs, the pod_name in OVS external_ids is set
to the VM name (e.g., 'ubuntu-vm-br'), not the launcher pod name
(e.g., 'virt-launcher-ubuntu-vm-br-xyz'). When gcInterfaces() tries
to look up the pod by the VM name, it fails and incorrectly deletes
the interface.
Solution: When a pod is not found by direct lookup, check if it might
be a KubeVirt VM by searching for launcher pods with the label
'vm.kubevirt.io/name' matching the pod_name from OVS. If a matching
launcher pod exists, keep the interface instead of deleting it.
This fix maintains backward compatibility with non-KubeVirt pods
while preventing false-positive deletions for KubeVirt VMs.
Signed-off-by: Damir Nugmanov <damir_nug@mail.ru>
Signed-off-by: dnugmanov <damir_nug@mail.ru>1 parent 1633e46 commit 72a6520
2 files changed
+24
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
731 | 748 | | |
732 | 749 | | |
733 | 750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
0 commit comments