Skip to content

Commit

Permalink
Enhance error handling for DataDiskIds in mcis provision
Browse files Browse the repository at this point in the history
  • Loading branch information
seokho-son committed Nov 5, 2022
1 parent a6d4bd9 commit b297ead
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/mcis/provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -1619,13 +1619,15 @@ func CreateVm(nsId string, mcisId string, vmInfoData *TbVmInfo, option string) e

var DataDiskIdsTmp []string
for _, v := range vmInfoData.DataDiskIds {
CspDataDiskId, err := common.GetCspResourceId(nsId, common.StrDataDisk, v)
if CspDataDiskId == "" {
common.CBLog.Error(err)
return err
// ignore DataDiskIds == "", assume it is ignorable mistake
if v != "" {
CspDataDiskId, err := common.GetCspResourceId(nsId, common.StrDataDisk, v)
if err != nil || CspDataDiskId == "" {
common.CBLog.Error(err)
return err
}
DataDiskIdsTmp = append(DataDiskIdsTmp, CspDataDiskId)
}

DataDiskIdsTmp = append(DataDiskIdsTmp, CspDataDiskId)
}
tempReq.ReqInfo.DataDiskNames = DataDiskIdsTmp

Expand Down

0 comments on commit b297ead

Please sign in to comment.