From 20d40860ce628c0ba313809901229fcf811b6d8b Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:20:09 +0800 Subject: [PATCH] feat: support skip MIG mode configuration in srivogpu (#1009) (#1027) (cherry picked from commit f6dffe9816b79a8b1f8de84c2abefb751d3acf4e) Signed-off-by: Jack Yu Co-authored-by: Jack Yu --- pkg/harvester/config/labels-annotations.js | 1 + pkg/harvester/dialog/EnableSriovGpuDevice.vue | 133 ++++++++++++++++++ pkg/harvester/l10n/en-us.yaml | 6 + ...devices.harvesterhci.io.sriovgpudevice.vue | 7 + .../devices.harvesterhci.io.sriovgpudevice.js | 19 ++- 5 files changed, 156 insertions(+), 10 deletions(-) create mode 100644 pkg/harvester/dialog/EnableSriovGpuDevice.vue 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 @@ + + + + + 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() {