From 2fe52ebd50b07caaf27e02185db9d8bd159d8c54 Mon Sep 17 00:00:00 2001 From: "Weber.Yang" Date: Fri, 1 Dec 2023 10:17:29 +0800 Subject: [PATCH] SKS-2160: Fix 'where' condition when getting GPU device allocation details (#157) --- pkg/service/vm.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pkg/service/vm.go b/pkg/service/vm.go index 20ca523f..6ec188a3 100644 --- a/pkg/service/vm.go +++ b/pkg/service/vm.go @@ -970,21 +970,19 @@ func (svr *TowerVMService) GetGPUDevicesAllocationInfoByHostIDs(hostIDs []string return NewGPUVMInfos(), nil } - where := &models.GpuDeviceWhereInput{ - UserUsage: models.NewGpuDeviceUsage(gpuDeviceUsage), - Host: &models.HostWhereInput{ - IDIn: hostIDs, + getDetailVMInfoByGpuDevicesParams := clientgpu.NewGetDetailVMInfoByGpuDevicesParams() + getDetailVMInfoByGpuDevicesParams.RequestBody = &models.GetGpuDevicesRequestBody{ + Where: &models.GpuDeviceWhereInput{ + UserUsage: models.NewGpuDeviceUsage(gpuDeviceUsage), + Host: &models.HostWhereInput{ + IDIn: hostIDs, + }, }, } // Filter GPU devices whose vGPU has been fully used if gpuDeviceUsage == models.GpuDeviceUsageVGPU { - where.AvailableVgpusNumGt = TowerInt32(0) - } - - getDetailVMInfoByGpuDevicesParams := clientgpu.NewGetDetailVMInfoByGpuDevicesParams() - getDetailVMInfoByGpuDevicesParams.RequestBody = &models.GetGpuDevicesRequestBody{ - Where: &models.GpuDeviceWhereInput{}, + getDetailVMInfoByGpuDevicesParams.RequestBody.Where.AvailableVgpusNumGt = TowerInt32(0) } getDetailVMInfoByGpuDevicesResp, err := svr.Session.GpuDevice.GetDetailVMInfoByGpuDevices(getDetailVMInfoByGpuDevicesParams)