Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
  • Loading branch information
torchiaf committed Aug 8, 2024
1 parent 9ea14af commit c5aa986
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions pkg/harvester-manager/machine-config/harvester.vue
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export default {
if (this.value.vgpuInfo) {
const vGPURequests = JSON.parse(this.value.vgpuInfo)?.vGPURequests;
vGpus = vGPURequests?.map((r) => r?.name).filter((r) => r) || [];
vGpus = vGPURequests?.map((r) => r?.deviceName).filter((f) => f) || [];
}
return {
Expand Down Expand Up @@ -482,10 +482,14 @@ export default {
},
vGpuOptions() {
return uniq([
const vGpuTypes = uniq([
...this.vGpusInit,
...Object.keys(this.vGpuDevices).filter((k) => this.vGpuDevices[k].enabled && this.vGpuDevices[k].allocatable > 0),
...Object.values(this.vGpuDevices)
.filter((vGpu) => vGpu.enabled && vGpu.allocatable > 0 && !!vGpu.type)
.map((vGpu) => vGpu.type),
]);
return vGpuTypes

Check warning on line 492 in pkg/harvester-manager/machine-config/harvester.vue

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
}
},
Expand Down Expand Up @@ -884,15 +888,18 @@ export default {
},
updateVGpu() {
const vGPURequests = this.vGpus?.filter((name) => name).reduce((acc, name) => ([
...acc,
{
name,
deviceName: this.vGpuDevices[name]?.type,
}
]), []);
/**
* We are assigning the first vGpu profile found for each vGpu type selected by the user.
* This will not work if we will remove the limit of only one vGpu assignable to each cluster.
*/
const vGPURequests = this.vGpus?.filter((f) => f).map((deviceName) => ({
name: Object.values(this.vGpuDevices).filter((f) => f.type === deviceName)?.[0]?.id || '',
deviceName,
})) || [];
this.value.vgpuInfo = vGPURequests.length > 0 ? JSON.stringify({ vGPURequests }) : '';
console.log(this.value.vgpuInfo)

Check warning on line 902 in pkg/harvester-manager/machine-config/harvester.vue

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement

Check warning on line 902 in pkg/harvester-manager/machine-config/harvester.vue

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
},
addCloudConfigComment(value) {
Expand Down Expand Up @@ -1091,18 +1098,6 @@ export default {
},
vGpuOptionLabel(opt) {
const vGpu = this.vGpuDevices[opt];
if (vGpu) {
let label = `${ vGpu.type?.replace(VGPU_PREFIX.NVIDIA, '') } - ${ vGpu.id }`;
if (vGpu.allocatable > 0) {
label += ` (allocatable: ${ vGpu.allocatable })`;
}
return label;
}
return opt;
}
}
Expand Down

0 comments on commit c5aa986

Please sign in to comment.