[pve-devel] [PATCH manager] gui: pci passthrough: fix 'Add PCI' dialog for new devices

Stefan Reiter s.reiter at proxmox.com
Mon Feb 17 14:36:28 CET 2020


Commit 6033f465b8 (gui: pci passthrough: consider domain in PCISelector)
used 'values.host' without checking if it's set, resulting in an error
when the dialog was opened for a new device (where values.host is
undefined).

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 www/manager6/qemu/PCIEdit.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/www/manager6/qemu/PCIEdit.js b/www/manager6/qemu/PCIEdit.js
index 1853d241..b10326ba 100644
--- a/www/manager6/qemu/PCIEdit.js
+++ b/www/manager6/qemu/PCIEdit.js
@@ -10,13 +10,16 @@ Ext.define('PVE.qemu.PCIInputPanel', {
 	var hostpci = me.vmconfig[me.confid] || '';
 
 	var values = PVE.Parser.parsePropertyString(hostpci, 'host');
-	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;
+	if (values.host) {
+	    if (!values.host.match(/^[0-9a-f]{4}:/i)) { // add optional domain
+		values.host = "0000:" + values.host;
+	    }
+	    if (values.host.length < 11) { // 0000:00:00 format not 0000:00:00.0
+		values.host += ".0";
+		values.multifunction = true;
+	    }
 	}
+
 	values['x-vga'] = PVE.Parser.parseBoolean(values['x-vga'], 0);
 	values.pcie = PVE.Parser.parseBoolean(values.pcie, 0);
 	values.rombar = PVE.Parser.parseBoolean(values.rombar, 1);
-- 
2.20.1





More information about the pve-devel mailing list