From f85e8d003d81df7376bc8c2e315d8908a9fac71a Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Thu, 2 Jan 2025 16:34:51 +0800 Subject: [PATCH] fix: vGPU number not correct Signed-off-by: andy.lee --- .../VirtualMachineVGpuDevices/index.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVGpuDevices/index.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVGpuDevices/index.vue index d34ce4a765f..5c99657b6a6 100644 --- a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVGpuDevices/index.vue +++ b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachineVGpuDevices/index.vue @@ -46,10 +46,13 @@ export default { this[key] = res[key]; } - uniq([ + const vGpus = this.vm.isOff ? [ ...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name), + ] : [ ...Object.values(this.vm?.provisionedVGpus).reduce((acc, gpus) => [...acc, ...gpus], []) - ]).forEach((name) => { + ]; + + uniq(vGpus).forEach((name) => { if (this.enabledDevices.find(device => device?.metadata?.name === name)) { this.selectedDevices.push(name); }