Skip to content

Commit 5bd71ba

Browse files
committed
add kubevirt multus nic lsp before gc process (#2504)
1 parent d9ccaf7 commit 5bd71ba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/controller/gc.go

+11
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,17 @@ func (c *Controller) getVmLsps() []string {
721721
for _, vm := range vms.Items {
722722
vmLsp := ovs.PodNameToPortName(vm.Name, ns.Name, util.OvnProvider)
723723
vmLsps = append(vmLsps, vmLsp)
724+
725+
attachNets, err := util.ParsePodNetworkAnnotation(vm.Spec.Template.ObjectMeta.Annotations[util.AttachmentNetworkAnnotation], vm.Namespace)
726+
if err != nil {
727+
klog.Errorf("failed to get attachment subnet of vm %s, %v", vm.Name, err)
728+
continue
729+
}
730+
for _, multiNet := range attachNets {
731+
provider := fmt.Sprintf("%s.%s.ovn", multiNet.Name, multiNet.Namespace)
732+
vmLsp := ovs.PodNameToPortName(vm.Name, ns.Name, provider)
733+
vmLsps = append(vmLsps, vmLsp)
734+
}
724735
}
725736
}
726737
}

0 commit comments

Comments
 (0)