fix: vGPU number not correct (#254)

Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit 26afffc2f1d9f86aad78f0be700853279a3c383d)
(cherry picked from commit 40dc31226b48feb47c5782645d288f7547520198)

Co-authored-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
mergify[bot] 2025-04-17 14:56:05 +08:00 committed by GitHub
parent 1e02dbffe3
commit 9d9383ba90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,10 +46,13 @@ export default {
this[key] = res[key]; this[key] = res[key];
} }
uniq([ const vGpus = this.vm.isOff ? [
...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name), ...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name),
] : [
...Object.values(this.vm?.provisionedVGpus).reduce((acc, gpus) => [...acc, ...gpus], []) ...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)) { if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
this.selectedDevices.push(name); this.selectedDevices.push(name);
} }