diff --git a/pkg/harvester/config/labels-annotations.js b/pkg/harvester/config/labels-annotations.js index 960038ac..7a4f0ab9 100644 --- a/pkg/harvester/config/labels-annotations.js +++ b/pkg/harvester/config/labels-annotations.js @@ -86,4 +86,5 @@ export const HCI = { CDI_POPULATOR_KIND: 'cdi.kubevirt.io/storage.populator.kind', CNI_NETWORKS: 'k8s.v1.cni.cncf.io/networks', WINDOWS_SYSPREP: 'harvesterhci.io/windows-sysprep', + SKIP_MIG_CONFIGURATION: 'harvesterhci.io/skip-mig-configuration', }; diff --git a/pkg/harvester/dialog/EnableSriovGpuDevice.vue b/pkg/harvester/dialog/EnableSriovGpuDevice.vue new file mode 100644 index 00000000..d7e67967 --- /dev/null +++ b/pkg/harvester/dialog/EnableSriovGpuDevice.vue @@ -0,0 +1,133 @@ + + + + + + + + + + + + + {{ t('harvester.sriovgpu.enable.note') }} + + + + + + + + {{ t('generic.cancel') }} + + + + + + + + + diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index 39ec3549..741df89b 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -2256,6 +2256,12 @@ harvester: prefix: The nvidia-driver-toolkit add-on is not enabled, click middle: here suffix: to enable it to manage your SR-IOV GPU devices. + enable: + title: Enable SR-IOV GPU Device + skipMigConfiguration: Use timesliced mode (skip MIG configuration) + note: If unchecked, MIG mode will be attempted by default. If MIG mode is not supported or fails to initialize, it will fall back to timesliced mode. The actual mode depends on whether the GPU supports MIG. + timeslicedBadge: timesliced mode + timesliced: Timesliced migconfiguration: label: vGPU MIG Configurations diff --git a/pkg/harvester/list/devices.harvesterhci.io.sriovgpudevice.vue b/pkg/harvester/list/devices.harvesterhci.io.sriovgpudevice.vue index dd395da8..10b5915d 100644 --- a/pkg/harvester/list/devices.harvesterhci.io.sriovgpudevice.vue +++ b/pkg/harvester/list/devices.harvesterhci.io.sriovgpudevice.vue @@ -86,6 +86,13 @@ export default { value: 'spec.address', sort: ['spec.address'] }, + { + name: 'timesliced', + labelKey: 'harvester.sriovgpu.timesliced', + value: 'isTimesliced', + formatter: 'Checked', + align: 'center', + }, { name: 'vfAddresses', label: 'VF Addresses', diff --git a/pkg/harvester/models/devices.harvesterhci.io.sriovgpudevice.js b/pkg/harvester/models/devices.harvesterhci.io.sriovgpudevice.js index c216c9b3..031309b7 100644 --- a/pkg/harvester/models/devices.harvesterhci.io.sriovgpudevice.js +++ b/pkg/harvester/models/devices.harvesterhci.io.sriovgpudevice.js @@ -69,16 +69,15 @@ export default class SRIOVDevice extends SteveModel { return this.spec.enabled && this.status?.vfAddresses?.length > 0 && this.status?.vGPUDevices?.length > 0; } - async enableDevice() { - try { - this.spec.enabled = true; - await this.save(); - } catch (err) { - this.$dispatch('growl/fromError', { - title: this.t('generic.notification.title.error', { name: escapeHtml(this.metadata.name) }), - err, - }, { root: true }); - } + get isTimesliced() { + return this.metadata?.annotations?.[HCI_ANNOTATIONS.SKIP_MIG_CONFIGURATION] === 'true'; + } + + enableDevice() { + this.$dispatch('promptModal', { + resources: [this], + component: 'EnableSriovGpuDevice' + }); } async disableDevice() {
+ {{ t('harvester.sriovgpu.enable.note') }} +