From 26afffc2f1d9f86aad78f0be700853279a3c383d 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 adc713a7..fe3ed759 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); }