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 <jack.yu@suse.com>
This commit is contained in:
Jack Yu 2026-06-05 11:18:04 +08:00 committed by GitHub
parent 836b04f222
commit b4ea7c8f98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 73 additions and 116 deletions

View File

@ -52,31 +52,21 @@ export default {
} }
const selectedDevices = []; const selectedDevices = [];
const oldFormatDevices = [];
const vmDevices = this.value?.domain?.devices?.hostDevices || []; const vmDevices = this.value?.domain?.devices?.hostDevices || [];
const otherDevices = this.otherDevices(vmDevices).map(({ name }) => name);
const vmDeviceNames = vmDevices.map(({ name }) => name); const vmDeviceNames = vmDevices.map(({ name }) => name);
this.pciDevices.forEach((row) => { this.pciDevices.forEach((row) => {
row.allowDisable = !vmDeviceNames.includes(row.metadata.name); row.allowDisable = !vmDeviceNames.includes(row.metadata.name);
}); });
vmDevices.forEach(({ name, deviceName }) => { vmDevices.forEach(({ name }) => {
const checkName = (deviceName || '').split('/')?.[1]; if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
if (checkName && name.includes(checkName) && !otherDevices.includes(name)) {
oldFormatDevices.push(name);
} else if (this.enabledDevices.find((device) => device?.metadata?.name === name)) {
selectedDevices.push(name); selectedDevices.push(name);
} }
}); });
if (oldFormatDevices.length > 0) {
this.oldFormatDevices = oldFormatDevices;
} else {
this.selectedDevices = selectedDevices; this.selectedDevices = selectedDevices;
}
}, },
data() { data() {
@ -87,7 +77,6 @@ export default {
selectedDevices: [], selectedDevices: [],
pciDeviceSchema: this.$store.getters['harvester/schemaFor'](HCI.PCI_DEVICE), pciDeviceSchema: this.$store.getters['harvester/schemaFor'](HCI.PCI_DEVICE),
showMatrix: false, showMatrix: false,
oldFormatDevices: [],
}; };
}, },
@ -199,11 +188,6 @@ export default {
}); });
}, },
oldFormatDevicesHTML() {
return this.oldFormatDevices.map((device) => {
return `<li>${ device }</li>`;
}).join('');
},
}, },
methods: { methods: {
@ -227,17 +211,6 @@ export default {
<template> <template>
<div> <div>
<div
v-if="oldFormatDevices.length > 0"
class="row"
>
<div class="col span-12">
<Banner color="warning">
<p v-clean-html="t('harvester.pci.oldFormatDevices.help', {oldFormatDevicesHTML}, true)" />
</Banner>
</div>
</div>
<div v-else>
<div class="row"> <div class="row">
<div class="col span-12"> <div class="col span-12">
<Banner color="info"> <Banner color="info">
@ -323,5 +296,4 @@ export default {
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>

View File

@ -392,21 +392,6 @@ harvester:
middle: vGPU Devices middle: vGPU Devices
suffix: page. suffix: page.
deviceInTheSameHost: 'You can only select devices on the same host.' deviceInTheSameHost: 'You can only select devices on the same host.'
oldFormatDevices:
help: |-
<p>
The following PCI devices are using the old naming convention and need to be updated in the YAML file:
</p>
<ul>
{oldFormatDevicesHTML}
</ul>
<p>
Please use the following instructions to update the virtual machine:
</p>
<ol>
<li>Stop the virtual machine, edit the virtual machine YAML, and remove the <Code>hostDevices</Code> section, and save virtual machine the changes to the YAML file.</li>
<li>Edit the virtual machine, and add the already enabled PCI Device from the list of available PCIDevices, and save and start VM.</li>
</ol>
showCompatibility: Show device compatibility matrix showCompatibility: Show device compatibility matrix
hideCompatibility: Hide device compatibility matrix hideCompatibility: Hide device compatibility matrix
claimError: Error enabling passthrough on {name} claimError: Error enabling passthrough on {name}