From b4ea7c8f98f074be5de687eafedf5521554e9e97 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 5 Jun 2026 11:18:04 +0800 Subject: [PATCH] feat: remove old format pci device name checking (#889) when implementing the first version pci device passthrough, we didn't have our own device plugin, then resource name was changed after upgrade. Right now, we already have our own device plugin, which we can control resource name by our ourselves. So, we can remove old mechanism. Signed-off-by: Jack Yu --- .../VirtualMachinePciDevices/index.vue | 174 ++++++++---------- pkg/harvester/l10n/en-us.yaml | 15 -- 2 files changed, 73 insertions(+), 116 deletions(-) diff --git a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachinePciDevices/index.vue b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachinePciDevices/index.vue index 69807ed7..e48acfd2 100644 --- a/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachinePciDevices/index.vue +++ b/pkg/harvester/edit/kubevirt.io.virtualmachine/VirtualMachinePciDevices/index.vue @@ -52,31 +52,21 @@ export default { } const selectedDevices = []; - const oldFormatDevices = []; const vmDevices = this.value?.domain?.devices?.hostDevices || []; - const otherDevices = this.otherDevices(vmDevices).map(({ name }) => name); const vmDeviceNames = vmDevices.map(({ name }) => name); this.pciDevices.forEach((row) => { row.allowDisable = !vmDeviceNames.includes(row.metadata.name); }); - vmDevices.forEach(({ name, deviceName }) => { - const checkName = (deviceName || '').split('/')?.[1]; - - if (checkName && name.includes(checkName) && !otherDevices.includes(name)) { - oldFormatDevices.push(name); - } else if (this.enabledDevices.find((device) => device?.metadata?.name === name)) { + vmDevices.forEach(({ name }) => { + if (this.enabledDevices.find((device) => device?.metadata?.name === name)) { selectedDevices.push(name); } }); - if (oldFormatDevices.length > 0) { - this.oldFormatDevices = oldFormatDevices; - } else { - this.selectedDevices = selectedDevices; - } + this.selectedDevices = selectedDevices; }, data() { @@ -87,7 +77,6 @@ export default { selectedDevices: [], pciDeviceSchema: this.$store.getters['harvester/schemaFor'](HCI.PCI_DEVICE), showMatrix: false, - oldFormatDevices: [], }; }, @@ -199,11 +188,6 @@ export default { }); }, - oldFormatDevicesHTML() { - return this.oldFormatDevices.map((device) => { - return `
  • ${ device }
  • `; - }).join(''); - }, }, methods: { @@ -227,101 +211,89 @@ export default { diff --git a/pkg/harvester/l10n/en-us.yaml b/pkg/harvester/l10n/en-us.yaml index 9b2581c2..7e6620ab 100644 --- a/pkg/harvester/l10n/en-us.yaml +++ b/pkg/harvester/l10n/en-us.yaml @@ -392,21 +392,6 @@ harvester: middle: vGPU Devices suffix: page. deviceInTheSameHost: 'You can only select devices on the same host.' - oldFormatDevices: - help: |- -

    - The following PCI devices are using the old naming convention and need to be updated in the YAML file: -

    - -

    - Please use the following instructions to update the virtual machine: -

    -
      -
    1. Stop the virtual machine, edit the virtual machine YAML, and remove the hostDevices section, and save virtual machine the changes to the YAML file.
    2. -
    3. Edit the virtual machine, and add the already enabled PCI Device from the list of available PCIDevices, and save and start VM.
    4. -
    showCompatibility: Show device compatibility matrix hideCompatibility: Hide device compatibility matrix claimError: Error enabling passthrough on {name}