[pve-devel] [PATCH v2 pve-manager 4/4] fix #3593: add js input for affinity

Daniel Bowder daniel at bowdernet.com
Fri Jul 1 02:09:48 CEST 2022


Adds a textfield for the affinity value. Delete that affinity value
when the textbox is empty.

Signed-off-by: Daniel Bowder <daniel at bowdernet.com>
---
 www/manager6/qemu/ProcessorEdit.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/www/manager6/qemu/ProcessorEdit.js b/www/manager6/qemu/ProcessorEdit.js
index 1bed2877..42c919f2 100644
--- a/www/manager6/qemu/ProcessorEdit.js
+++ b/www/manager6/qemu/ProcessorEdit.js
@@ -27,6 +27,17 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
 	    values.delete = values.delete.join(',');
 	}
 
+	if (values.affinity === undefined ||
+	    values.affinity === null ||
+	    values.affinity === '') {
+		if (values.delete.length > 0) {
+		    values.delete = values.delete + ",affinity";
+		} else {
+		    values.delete = "affinity";
+		}
+		delete values.affinity;
+	}
+
 	PVE.Utils.delete_if_default(values, 'cpulimit', '0', 0);
 	PVE.Utils.delete_if_default(values, 'cpuunits', '1024', 0);
 
@@ -180,6 +191,18 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
 	    allowBlank: true,
 	    emptyText: gettext('unlimited'),
 	},
+	{
+	    xtype: 'textfield',
+	    name: 'affinity',
+	    vtype: 'CpuSet',
+	    value: '',
+	    fieldLabel: gettext('CPU affinity'),
+	    allowBlank: true,
+	    emptyText: gettext("all cores"),
+	    bind: {
+		value: '{affinity}',
+	    },
+	},
     ],
 
     advancedColumn2: [
-- 
2.36.1





More information about the pve-devel mailing list