Skip to content

Commit 22367be

Browse files
committed
cni-server: do not perform ipv4 conflict detection during VM live migration (#2693)
1 parent 49dfd39 commit 22367be

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
@@ -213,7 +213,8 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
213213
u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP
214214
}
215215

216-
//skip ping check gateway for pods during live migration
216+
detectIPConflict := podSubnet.Spec.Vlan != ""
217+
// skip ping check gateway for pods during live migration
217218
if pod.Annotations[fmt.Sprintf(util.LiveMigrationAnnotationTemplate, podRequest.Provider)] != "true" {
218219
if podSubnet.Spec.Vlan != "" && !podSubnet.Spec.LogicalGateway {
219220
if podSubnet.Spec.DisableGatewayCheck {
@@ -228,6 +229,9 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
228229
gatewayCheckMode = gatewayCheckModePing
229230
}
230231
}
232+
} else {
233+
// do not perform ipv4 conflict detection during VM live migration
234+
detectIPConflict = false
231235
}
232236

233237
var mtu int
@@ -304,7 +308,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
304308
}
305309

306310
klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, u2o routes %v, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, u2oRoutes, podRequest.Routes)
307-
detectIPConflict := podSubnet.Spec.Vlan != ""
308311
allRoutes := append(u2oRoutes, podRequest.Routes...)
309312
if nicType == util.InternalType {
310313
podNicName, err = csh.configureNicWithInternalPort(podRequest.PodName, podRequest.PodNamespace, podRequest.Provider, podRequest.NetNs, podRequest.ContainerID, ifName, macAddr, mtu, ipAddr, gw, isDefaultRoute, detectIPConflict, allRoutes, podRequest.DNS.Nameservers, podRequest.DNS.Search, ingress, egress, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP)

0 commit comments

Comments
 (0)