[pve-devel] [PATCH manager 1/1] gui: pci passthrough: consider domain in PCISelector

Dominik Csapak d.csapak at proxmox.com
Tue Nov 12 14:23:04 CET 2019


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 at proxmox.com>
---
 www/manager6/form/PCISelector.js |  2 +-
 www/manager6/qemu/PCIEdit.js     | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/www/manager6/form/PCISelector.js b/www/manager6/form/PCISelector.js
index 1061ef4d..c6847b67 100644
--- a/www/manager6/form/PCISelector.js
+++ b/www/manager6/form/PCISelector.js
@@ -27,7 +27,7 @@ Ext.define('PVE.form.PCISelector', {
 	    {
 		header: 'ID',
 		dataIndex: 'id',
-		width: 80
+		width: 100
 	    },
 	    {
 		header: gettext('IOMMU Group'),
diff --git a/www/manager6/qemu/PCIEdit.js b/www/manager6/qemu/PCIEdit.js
index 6ff13808..1853d241 100644
--- a/www/manager6/qemu/PCIEdit.js
+++ b/www/manager6/qemu/PCIEdit.js
@@ -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;
 	}
 
-- 
2.20.1





More information about the pve-devel mailing list