From be77557c5a40968c4e3c8fca64f806c2f7b36257 Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Sat, 22 Apr 2023 14:54:41 +0800 Subject: [PATCH] cni-server: do not perform ipv4 conflict detection during VM live migration --- pkg/daemon/handler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/handler.go b/pkg/daemon/handler.go index 704c344d8a7..e6d78cb0e5a 100644 --- a/pkg/daemon/handler.go +++ b/pkg/daemon/handler.go @@ -226,6 +226,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP } + detectIPConflict := podSubnet.Spec.Vlan != "" // skip ping check gateway for pods during live migration if pod.Annotations[fmt.Sprintf(util.LiveMigrationAnnotationTemplate, podRequest.Provider)] != "true" { if podSubnet.Spec.Vlan != "" && !podSubnet.Spec.LogicalGateway { @@ -241,6 +242,9 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon gatewayCheckMode = gatewayCheckModePing } } + } else { + // do not perform ipv4 conflict detection during VM live migration + detectIPConflict = false } var mtu int @@ -271,7 +275,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon routes = append(podRequest.Routes, routes...) klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, routes) - detectIPConflict := podSubnet.Spec.Vlan != "" if nicType == util.InternalType { podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, routes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, podRequest.DeviceID, nicType, latency, limit, loss, jitter, gatewayCheckMode, u2oInterconnectionIP) } else if nicType == util.DpdkType {