region: attachnetwork: allow attach by network name

isValidNetworkInfo allows names.  Otherwise the code will panic when
a named was passed and nil was returned by the fetch call
This commit is contained in:
Yousong Zhou
2021-03-22 19:34:01 +08:00
parent 1d19289ccb
commit 90fd8c868f
4 changed files with 5 additions and 5 deletions
@@ -59,7 +59,7 @@ func fetchGuestUsageFromSchedInfo(s *api.SchedInfo) (computemodels.SQuota, compu
iNicCnt := 0
for _, netConfig := range s.Networks {
if computemodels.IsExitNetworkInfo(netConfig) {
if computemodels.IsExitNetworkInfo(s.UserCred, netConfig) {
eNicCnt += 1
} else {
iNicCnt += 1