fix(host): setup routes from start to end (#18674)

This commit is contained in:
Zexi Li
2023-11-14 17:56:11 +08:00
committed by GitHub
parent 64027a3280
commit c810a3b144
2 changed files with 2 additions and 9 deletions
+1 -8
View File
@@ -15,8 +15,6 @@
package hostman
import (
"time"
execlient "yunion.io/x/executor/client"
"yunion.io/x/log"
@@ -79,12 +77,7 @@ func (host *SHostService) RunService() {
hostInstance := hostinfo.Instance()
if err := hostInstance.Init(); err != nil {
log.Errorf("Host instance init error: %v", err)
for {
// to catch error
time.Sleep(10 * time.Second)
}
// log.Fatalf("Host instance init error: %v", err)
log.Fatalf("Host instance init error: %v", err)
}
app_common.InitAuth(&options.HostOptions.CommonOptions, func() {
@@ -273,7 +273,7 @@ func (d *SBaseBridgeDriver) SetupRoutes(routespecs []iproute2.RouteSpec) error {
bridgeIP := d.inter.Addr
bridgeMask := d.inter.Mask
br := d.bridge.String()
for i := len(routespecs) - 1; i >= 0; i-- {
for i := 0; i < len(routespecs); i++ {
errs := []error{}
routespec := routespecs[i]
if routespec.Dst.Contains(net.ParseIP(bridgeIP)) && bridgeMask.String() == routespec.Dst.Mask.String() {