Merge pull request #1091 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-nested-invalid-network-error to release/2.6.0

* commit '32299a14652098d1ab3105779a866e08e66eb17c':
  fix: isValidNetworkInfo return httperrors, should not be wrapped as a httperror again
This commit is contained in:
李泽玺
2019-02-21 12:27:13 +08:00
+5 -3
View File
@@ -1366,15 +1366,17 @@ func (self *SGuest) PerformChangeIpaddr(ctx context.Context, userCred mcclient.T
netDesc, err := data.Get("net_desc")
if err != nil {
return nil, httperrors.NewBadRequestError(err.Error())
log.Errorf("net_desc not found")
return nil, httperrors.NewInputParameterError("missing net_desc")
}
conf, err := parseNetworkInfo(userCred, netDesc)
if err != nil {
log.Errorf("parseNetworkInfo fail %s", err)
return nil, err
}
err = isValidNetworkInfo(userCred, conf)
if err != nil {
return nil, httperrors.NewBadRequestError(err.Error())
return nil, err
}
host := self.GetHost()
@@ -1492,7 +1494,7 @@ func (self *SGuest) PerformAttachnetwork(ctx context.Context, userCred mcclient.
}
err = isValidNetworkInfo(userCred, conf)
if err != nil {
return nil, httperrors.NewBadRequestError(err.Error())
return nil, err
}
var inicCnt, enicCnt, ibw, ebw int
if isExitNetworkInfo(conf) {