Merge pull request #1939 from yousong/bugfix/yousong-lbbackends-loglines

lbbackends: 若backend guest已删除getVpc返回空且不报错
This commit is contained in:
yunion-ci-robot
2019-07-26 18:13:10 +08:00
committed by GitHub
+5 -1
View File
@@ -16,6 +16,7 @@ package models
import (
"context"
"database/sql"
"fmt"
"github.com/pkg/errors"
@@ -362,7 +363,10 @@ func (lbb *SLoadbalancerBackend) getVpc(ctx context.Context) (*SVpc, error) {
}
guestM, err := GuestManager.FetchById(lbb.BackendId)
if err != nil {
theLbbJanitor.Signal()
if err == sql.ErrNoRows {
theLbbJanitor.Signal()
return nil, nil
}
return nil, errors.WithMessagef(err, "find guest %s", lbb.BackendId)
}
guest := guestM.(*SGuest)