Skip to content

Commit

Permalink
gpu 정보추출 오류보완 at acceleratorsToGPUInfoList gcp
Browse files Browse the repository at this point in the history
  • Loading branch information
dogfootman committed Dec 23, 2024
1 parent 4e53208 commit 1d1cae4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (vmSpecHandler *GCPVMSpecHandler) ListVMSpec() ([]*irs.VMSpecInfo, error) {
Gpu: gpuInfoList,
}

info.KeyValueList, err = ConvertKeyValueList(info)
info.KeyValueList, err = ConvertKeyValueList(i)
if err != nil {
info.KeyValueList = nil
cblogger.Error(err)
Expand Down Expand Up @@ -231,7 +231,7 @@ func acceleratorsToGPUInfoList(accerators []*compute.MachineTypeAccelerators) []
accrType := strings.Split(accelerator.GuestAcceleratorType, "-")
if len(accrType) >= 3 {
// 첫 번째 요소를 Mfr에 할당
gpuInfo.Mfr = strings.ToUpper(strings.Replace(accrType[0], "", "NA", -1))
gpuInfo.Mfr = strings.ToUpper(accrType[0])

// 마지막 요소를 확인
lastElement := accrType[len(accrType)-1]
Expand All @@ -243,14 +243,14 @@ func acceleratorsToGPUInfoList(accerators []*compute.MachineTypeAccelerators) []
}
// 첫 번째와 마지막 요소를 제외한 나머지를 Model에 할당
if len(accrType) > 2 {
gpuInfo.Model = strings.ToUpper(strings.Replace(strings.Join(accrType[1:len(accrType)-1], " "), "", "NA", -1))
gpuInfo.Model = strings.ToUpper(strings.Join(accrType[1:len(accrType)-1], " "))
}
} else {
// 마지막 요소가 "gb"로 끝나지 않는 경우
gpuInfo.Mem = "" // Mem은 빈 문자열로 설정
if len(accrType) > 1 {
// 첫 번째 요소를 제외한 나머지를 Model에 할당
gpuInfo.Model = strings.ToUpper(strings.Replace(strings.Join(accrType[1:], " "), "", "NA", -1))
gpuInfo.Model = strings.ToUpper(strings.Join(accrType[1:], " "))
}
}
}
Expand Down

0 comments on commit 1d1cae4

Please sign in to comment.