Update selected vGpus devices adding the provisioned devices

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-10-23 17:01:33 +02:00
parent fa545ad134
commit 8117e99b54
3 changed files with 17 additions and 2 deletions
@@ -8,6 +8,7 @@ import remove from 'lodash/remove';
import { set } from '@shell/utils/object';
import { HCI } from '../../../types';
import VGpuDeviceList from './VGpuDeviceList';
import { uniq } from '@shell/utils/array';
export default {
name: 'VirtualMachineVGpuDevices',
@@ -45,7 +46,10 @@ export default {
this[key] = res[key];
}
(this.value?.domain?.devices?.gpus || []).forEach(({ name }) => {
uniq([
...(this.value?.domain?.devices?.gpus || []).map(({ name }) => name),
...Object.values(this.vm?.provisionedVGpus).reduce((acc, gpus) => [...acc, ...gpus], [])
]).forEach((name) => {
if (this.enabledDevices.find(device => device?.metadata?.name === name)) {
this.selectedDevices.push(name);
}