[pve-devel] [PATCH manager] fix #1208: add ballooning checkbox to memory edit

Dominik Csapak d.csapak at proxmox.com
Tue Nov 22 15:28:10 CET 2016


when using fixed memory size, we implicitly deleted shares and
ballon, which removed a (manually) set balloon: 0,

to be able to set this via the gui, we add a checkbox to the fixed
memory edit (using variable memory always needs ballooning)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/qemu/MemoryEdit.js | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 821a8ae..f979d40 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -12,7 +12,13 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 
 	if (values.memoryType === 'fixed') {
 	    res = { memory: values.memory };
-	    res['delete'] = "balloon,shares";
+	    if (values.ballooning === '1') {
+		// if balloning is active if it is not explicitely set
+		res['delete'] = "balloon,shares";
+	    } else {
+		res['delete'] = "shares";
+		res.balloon = 0;
+	    }
 	} else {
 	    res = { 
 		memory: values.maxmemory,
@@ -45,6 +51,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 			    return;
 			}
 			me.down('field[name=memory]').setDisabled(!value);
+			me.down('field[name=ballooning]').setDisabled(!value);
 			me.down('field[name=maxmemory]').setDisabled(value);
 			me.down('field[name=balloon]').setDisabled(value);
 			me.down('field[name=shares]').setDisabled(value);
@@ -60,6 +67,15 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 		labelWidth: labelWidth
 	    },
 	    {
+		xtype: 'pvecheckbox',
+		hotplug: me.hotplug,
+		name: 'ballooning',
+		value: '1',
+		labelAlign: 'right',
+		labelWidth: labelWidth,
+		fieldLabel: gettext('Ballooning')
+	    },
+	    {
 		xtype: 'radiofield',
 		name: 'memoryType',
 		inputValue: 'dynamic',
@@ -169,6 +185,7 @@ Ext.define('PVE.qemu.MemoryEdit', {
 		    memory: data.memory,
 		    maxmemory: data.memory,
 		    balloon: data.balloon,
+		    ballooning: data.balloon === 0 ? '0' : '1',
 		    shares: data.shares,
 		    memoryType: data.balloon ? 'dynamic' : 'fixed'
 		};
-- 
2.1.4





More information about the pve-devel mailing list