From 9d9383ba90738f9e1ca16377df72bfe53832b6dc Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 14:56:05 +0800 Subject: [PATCH] fix: vGPU number not correct (#254) Signed-off-by: andy.lee (cherry picked from commit 26afffc2f1d9f86aad78f0be700853279a3c383d) (cherry picked from commit 40dc31226b48feb47c5782645d288f7547520198) Co-authored-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); }