Skip to content

Commit

Permalink
fix: restart when init ping failed
Browse files Browse the repository at this point in the history
(cherry picked from commit 9d3b78a)
  • Loading branch information
oilbeater committed Mar 9, 2021
1 parent 4b75298 commit ecbd43e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,30 @@ func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int
protocol := util.CheckProtocol(gw)
if protocol == kubeovnv1.ProtocolDual {
gws := strings.Split(gw, ",")
output, _ = exec.Command("ping", "-w", "10", gws[0]).CombinedOutput()
output, err = exec.Command("ping", "-w", "10", gws[0]).CombinedOutput()
klog.Infof("ping v4 gw result is: \n %s", output)
if err != nil {
klog.Errorf("ovn0 failed to ping gw %s, %v", gws[0], err)
return err
}

output, _ = exec.Command("ping", "-6", "-w", "10", gws[1]).CombinedOutput()
output, err = exec.Command("ping6", "-w", "10", gws[1]).CombinedOutput()
if err != nil {
klog.Errorf("ovn0 failed to ping gw %s, %v", gws[1], err)
return err
}
} else if protocol == kubeovnv1.ProtocolIPv4 {
output, _ = exec.Command("ping", "-w", "10", gw).CombinedOutput()
output, err = exec.Command("ping", "-w", "10", gw).CombinedOutput()
if err != nil {
klog.Errorf("ovn0 failed to ping gw %s, %v", gw, err)
return err
}
} else {
output, _ = exec.Command("ping", "-6", "-w", "10", gw).CombinedOutput()
output, err = exec.Command("ping6", "-w", "10", gw).CombinedOutput()
if err != nil {
klog.Errorf("ovn0 failed to ping gw %s, %v", gw, err)
return err
}
}

klog.Infof("ping gw result is: \n %s", output)
Expand Down

0 comments on commit ecbd43e

Please sign in to comment.