all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/3] close #5291: ui: qemu: memory edit: support disabling KSM for specific VMs
Date: Mon, 17 Feb 2025 16:04:43 +0100	[thread overview]
Message-ID: <20250217150444.142182-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250217150444.142182-1-f.ebner@proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 www/manager6/qemu/HardwareView.js | 11 +++++++-
 www/manager6/qemu/MemoryEdit.js   | 43 ++++++++++++++++++++++++++-----
 2 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index c6d193fc..815dfcc2 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -73,7 +73,7 @@ Ext.define('PVE.qemu.HardwareView', {
 		defaultValue: '512',
 		tdCls: 'pve-itype-icon-memory',
 		group: 2,
-		multiKey: ['memory', 'balloon', 'shares'],
+		multiKey: ['memory', 'balloon', 'shares', 'allow-ksm'],
 		renderer: function(value, metaData, record, ri, ci, store, pending) {
 		    var res = '';
 
@@ -92,6 +92,12 @@ Ext.define('PVE.qemu.HardwareView', {
 		    } else if (balloon === 0) {
 			res += ' [balloon=0]';
 		    }
+
+		    let allowKsm = me.getObjectValue('allow-ksm', undefined, pending);
+		    if (allowKsm !== undefined) {
+			res += ' [allow-ksm=' + allowKsm + ']';
+		    }
+
 		    return res;
 		},
 	    },
@@ -197,6 +203,9 @@ Ext.define('PVE.qemu.HardwareView', {
 	    numa: {
 		visible: false,
 	    },
+	    'allow-ksm': {
+		visible: false,
+	    },
 	    balloon: {
 		visible: false,
 	    },
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 5e91dc9b..e7f1f688 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -32,23 +32,39 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
     },
 
     onGetValues: function(values) {
-	var me = this;
+	let res = {};
 
-	var res = {};
+	let deleteSet = new Set([]);
+
+	// properties that can be passed as-is
+	let propagate = ['allow-ksm', 'memory'];
+
+	propagate.forEach(function(prop) {
+	    if (values.delete?.split(',').includes(prop)) {
+		deleteSet.add(prop);
+	    }
+	    if (prop in values) {
+		res[prop] = values[prop];
+	    }
+	});
 
-	res.memory = values.memory;
 	res.balloon = values.balloon;
 
 	if (!values.ballooning) {
 	    res.balloon = 0;
-	    res.delete = 'shares';
+	    deleteSet.add('shares');
 	} else if (values.memory === values.balloon) {
 	    delete res.balloon;
-	    res.delete = 'balloon,shares';
+	    deleteSet.add('balloon');
+	    deleteSet.add('shares');
 	} else if (Ext.isDefined(values.shares) && values.shares !== "") {
 	    res.shares = values.shares;
 	} else {
-	    res.delete = "shares";
+	    deleteSet.add('shares');
+	}
+
+	if (deleteSet.size > 0) {
+	    res.delete = deleteSet.keys().toArray().join(',');
 	}
 
 	return res;
@@ -132,6 +148,20 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 		    },
 		},
 	    },
+	    {
+		xtype: 'proxmoxcheckbox',
+		name: 'allow-ksm',
+		labelWidth: labelWidth,
+		fieldLabel: gettext('Allow KSM'),
+		checked: true,
+		uncheckedValue: '0',
+		defaultValue: '1',
+		deleteDefaultValue: true,
+		autoEl: {
+		    tag: 'div',
+		    'data-qtip': gettext('Allow the Kernel Samepage Merging daemon to merge memory pages of this VM.'),
+		},
+	    },
 	];
 
 	if (me.insideWizard) {
@@ -183,6 +213,7 @@ Ext.define('PVE.qemu.MemoryEdit', {
 		    shares: data.shares,
 		    memory: data.memory || '512',
 		    balloon: data.balloon > 0 ? data.balloon : data.memory || '512',
+		    'allow-ksm': data['allow-ksm'] ?? true,
 		};
 
 		ipanel.setValues(values);
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  parent reply	other threads:[~2025-02-17 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 15:04 [pve-devel] [PATCH qemu-server/manager/docs 0/3] close #5291: " Fiona Ebner
2025-02-17 15:04 ` [pve-devel] [PATCH qemu-server 1/3] " Fiona Ebner
2025-02-17 15:04 ` Fiona Ebner [this message]
2025-02-17 15:04 ` [pve-devel] [PATCH docs 3/3] kernel samepage merging: describe how to disable for a specific VM Fiona Ebner
2025-02-18 12:39 ` [pve-devel] [PATCH qemu-server/manager/docs 0/3] close #5291: support disabling KSM for specific VMs Friedrich Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217150444.142182-3-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal