[pve-devel] [PATCH manager 1/2] gui: qemu HardwareView: specify hardware counts in Utils

Dominik Csapak d.csapak at proxmox.com
Fri Jan 17 17:14:09 CET 2020


this also fixes the issue that we only showed 4 hostpci devices in
the gui despite raising the limit in the backend to 16

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js             | 2 ++
 www/manager6/qemu/HardwareView.js | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index e61e2693..4c6cb258 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1210,6 +1210,8 @@ Ext.define('PVE.Utils', { utilities: {
 	}
     },
 
+    hardware_counts: { net: 32, usb: 5, hostpci: 16, audio: 1, efidisk: 1, serial: 4 },
+
     cleanEmptyObjectKeys: function (obj) {
 	var propName;
 	for (propName in obj) {
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 583b4000..7bd39726 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -234,7 +234,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		cloudheader: gettext('CloudInit Drive') + ' (' + confid + ')'
 	    };
 	});
-	for (i = 0; i < 32; i++) {
+	for (i = 0; i < PVE.Utils.hardware_counts.net; i++) {
 	    confid = "net" + i.toString();
 	    rows[confid] = {
 		group: 15,
@@ -252,7 +252,7 @@ Ext.define('PVE.qemu.HardwareView', {
 	    never_delete: caps.vms['VM.Config.Disk'] ? false : true,
 	    header: gettext('EFI Disk')
 	};
-	for (i = 0; i < 5; i++) {
+	for (i = 0; i < PVE.Utils.hardware_counts.usb; i++) {
 	    confid = "usb" + i.toString();
 	    rows[confid] = {
 		group: 25,
@@ -263,7 +263,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		header: gettext('USB Device') + ' (' + confid + ')'
 	    };
 	}
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < PVE.Utils.hardware_counts.hostpci; i++) {
 	    confid = "hostpci" + i.toString();
 	    rows[confid] = {
 		group: 30,
@@ -274,7 +274,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		header: gettext('PCI Device') + ' (' + confid + ')'
 	    };
 	}
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < PVE.Utils.hardware_counts.serial; i++) {
 	    confid = "serial" + i.toString();
 	    rows[confid] = {
 		group: 35,
-- 
2.20.1





More information about the pve-devel mailing list