[pve-devel] [PATCH manager] gui: preserve extra cpu options when changing CPU type

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jan 27 10:10:13 CET 2016


---
 www/manager/qemu/ProcessorEdit.js | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/www/manager/qemu/ProcessorEdit.js b/www/manager/qemu/ProcessorEdit.js
index 4bb3d92..54dfa7d 100644
--- a/www/manager/qemu/ProcessorEdit.js
+++ b/www/manager/qemu/ProcessorEdit.js
@@ -2,6 +2,14 @@ Ext.define('PVE.qemu.ProcessorInputPanel', {
     extend: 'PVE.panel.InputPanel',
     alias: 'widget.PVE.qemu.ProcessorInputPanel',
 
+    onGetValues: function(values) {
+	var me = this;
+	if (me.cpuextra.length) {
+	    values['cpu'] += ',' + me.cpuextra;
+	}
+	return values;
+    },
+
     initComponent : function() {
 	var me = this;
 
@@ -74,13 +82,21 @@ Ext.define('PVE.qemu.ProcessorEdit', {
     initComponent : function() {
 	var me = this;
 	
+	var ipanel = Ext.create('PVE.qemu.ProcessorInputPanel')
+
 	Ext.apply(me, {
 	    subject: gettext('Processors'),
-	    items: Ext.create('PVE.qemu.ProcessorInputPanel')
+	    items: ipanel
 	});
 
 	me.callParent();
 
-	me.load();
+	me.load({
+	    success: function(response, options) {
+		var cpudata = response.result.data['cpu'].split(',', 2);
+		ipanel.cpuextra = cpudata.length > 1 ? cpudata[1] : '';
+		me.setValues({ cpu: cpudata[0] });
+	    }
+	});
     }
 });
-- 
2.1.4





More information about the pve-devel mailing list