Skip to content

Commit

Permalink
Merge pull request #10994 from torchiaf/vgpu-integration-2-2-8
Browse files Browse the repository at this point in the history
[2.8] Limit number of assigned vGPUs to 1 for each Machine Pool
  • Loading branch information
torchiaf authored May 9, 2024
2 parents a8c6747 + 3d6b5e0 commit c8431af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 9 additions & 4 deletions pkg/harvester-manager/machine-config/harvester.vue
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,8 @@ export default {
.reduce((acc, v) => ({
...acc,
[v.id]: {
type: VGPU_PREFIX.NVIDIA + v.spec.vGPUTypeName.replace(' ', '_'),
profile: v.id.split('-')?.[2]
type: VGPU_PREFIX.NVIDIA + v.spec.vGPUTypeName?.replace(' ', '_'),
id: v.id
},
}), {});
}
Expand Down Expand Up @@ -1103,7 +1103,7 @@ export default {
vGpuOptionLabel(opt) {
const vGpu = this.vGpuEnabledDevices[opt];
return `${ vGpu?.type?.replace(VGPU_PREFIX.NVIDIA, '') } (profile: ${ vGpu?.profile } - allocatable: ${ this.vGpusAllocatable[vGpu?.type] })`;
return `${ vGpu?.type?.replace(VGPU_PREFIX.NVIDIA, '') } - ${ vGpu?.id } (allocatable: ${ this.vGpusAllocatable[vGpu?.type] })`;
}
}
};
Expand Down Expand Up @@ -1368,7 +1368,12 @@ export default {
<ArrayListSelect
v-model="vGpus"
class="mt-20"
:array-list-props="{ addAllowed: true, mode, disabled }"
:array-list-props="{
addAllowed: true,
addDisabled: vGpus.length > 0,
mode,
disabled
}"
:select-props="{
mode,
disabled,
Expand Down
9 changes: 8 additions & 1 deletion shell/components/form/ArrayList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export default {
type: Boolean,
default: true,
},
addDisabled: {
type: Boolean,
default: false,
},
removeLabel: {
type: String,
default() {
Expand Down Expand Up @@ -107,6 +111,9 @@ export default {
showAdd() {
return this.addAllowed;
},
disableAdd() {
return this.addDisabled;
},
showRemove() {
return this.removeAllowed;
},
Expand Down Expand Up @@ -338,7 +345,7 @@ export default {
<button
type="button"
class="btn role-tertiary add"
:disabled="loading"
:disabled="loading || disableAdd"
data-testid="array-list-button"
@click="add()"
>
Expand Down

0 comments on commit c8431af

Please sign in to comment.