Skip to content

Commit

Permalink
cni-server: do not perform ipv4 conflict detection during VM live mig…
Browse files Browse the repository at this point in the history
…ration (#2693)
  • Loading branch information
zhangzujian committed Apr 24, 2023
1 parent e67cfd4 commit 42da9dd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
u2oInterconnectionIP = podSubnet.Status.U2OInterconnectionIP
}

//skip ping check gateway for pods during live migration
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.DisableGatewayCheck {
if podSubnet.Spec.Vlan != "" && !podSubnet.Spec.LogicalGateway {
Expand All @@ -209,6 +210,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
Expand Down Expand Up @@ -237,7 +241,6 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
mtu = csh.Config.MTU
}

detectIPConflict := podSubnet.Spec.Vlan != ""
klog.Infof("create container interface %s mac %s, ip %s, cidr %s, gw %s, custom routes %v", ifName, macAddr, ipAddr, cidr, gw, podRequest.Routes)
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, podRequest.Routes, ingress, egress, priority, podRequest.DeviceID, nicType, latency, limit, loss, gatewayCheckMode, u2oInterconnectionIP)
Expand Down

0 comments on commit 42da9dd

Please sign in to comment.