mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): avoid sync esxi panic (#17791)
This commit is contained in:
@@ -4551,7 +4551,7 @@ func (h *SHost) addNetif(ctx context.Context, userCred mcclient.TokenCredential,
|
||||
}
|
||||
netif, err := NetInterfaceManager.FetchByMacVlan(mac, vlanId)
|
||||
if err != nil {
|
||||
if err != sql.ErrNoRows {
|
||||
if errors.Cause(err) != sql.ErrNoRows {
|
||||
return httperrors.NewInternalServerError("fail to fetch netif by mac %s: %s", mac, err)
|
||||
}
|
||||
// else not found
|
||||
|
||||
@@ -96,11 +96,7 @@ func (manager *SNetInterfaceManager) FetchByMacVlan(mac string, vlanId int) (*SN
|
||||
ret := &SNetInterface{}
|
||||
err := q.First(ret)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
} else {
|
||||
return nil, errors.Wrap(err, "Query")
|
||||
}
|
||||
return nil, errors.Wrapf(err, "First")
|
||||
}
|
||||
ret.SetModelManager(manager, ret)
|
||||
return ret, nil
|
||||
|
||||
Reference in New Issue
Block a user