gui: pci passthrough: consider domain in PCISelector

but remove the default domain '0000' before sending to the backend,
and add it if no domain is given in the config

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-11-12 14:23:04 +01:00 committed by Thomas Lamprecht
parent 4b527db9e5
commit f36240c507
2 changed files with 10 additions and 3 deletions

View File

@ -27,7 +27,7 @@ Ext.define('PVE.form.PCISelector', {
{
header: 'ID',
dataIndex: 'id',
width: 80
width: 100
},
{
header: gettext('IOMMU Group'),

View File

@ -10,7 +10,10 @@ Ext.define('PVE.qemu.PCIInputPanel', {
var hostpci = me.vmconfig[me.confid] || '';
var values = PVE.Parser.parsePropertyString(hostpci, 'host');
if (values.host && values.host.length < 6) { // 00:00 format not 00:00.0
if (!values.host.match(/^[0-9a-f]{4}:/i)) { // add optional domain
values.host = "0000:" + values.host;
}
if (values.host && values.host.length < 11) { // 0000:00:00 format not 0000:00:00.0
values.host += ".0";
values.multifunction = true;
}
@ -43,9 +46,13 @@ Ext.define('PVE.qemu.PCIInputPanel', {
}
}
}
// remove optional '0000' domain
if (values.host.substring(0,5) === '0000:') {
values.host = values.host.substring(5);
}
if (values.multifunction) {
// modify host to skip the '.X'
values.host = values.host.substring(0,5);
values.host = values.host.substring(0, values.host.indexOf('.'));
delete values.multifunction;
}