Skip to content

Commit 42da9dd

Browse files
committed
cni-server: do not perform ipv4 conflict detection during VM live migration (#2693)
1 parent e67cfd4 commit 42da9dd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/daemon/handler.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
200200
u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP
201201
}
202202

203-
//skip ping check gateway for pods during live migration
203+
detectIPConflict := podSubnet.Spec.Vlan != ""
204+
// skip ping check gateway for pods during live migration
204205
if pod.Annotations[fmt.Sprintf(util.LiveMigrationAnnotationTemplate, podRequest.Provider)] != "true" {
205206
if !podSubnet.Spec.DisableGatewayCheck {
206207
if podSubnet.Spec.Vlan != "" && !podSubnet.Spec.LogicalGateway {
@@ -209,6 +210,9 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
209210
gatewayCheckMode = gatewayCheckModePing
210211
}
211212
}
213+
} else {
214+
// do not perform ipv4 conflict detection during VM live migration
215+
detectIPConflict = false
212216
}
213217

214218
var mtu int
@@ -237,7 +241,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
237241
mtu = csh.Config.MTU
238242
}
239243

240-
detectIPConflict := podSubnet.Spec.Vlan != ""
241244
klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, podRequest.Routes)
242245
if nicType == util.InternalType {
243246
podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, podRequest.Routes, ingress, egress, priority, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP)

0 commit comments

Comments
 (0)