public inbox for pve-devel@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 v2 2/3] close #5291: ui: qemu: memory edit: support disabling KSM for specific VMs
Date: Thu, 13 Nov 2025 16:51:08 +0100	[thread overview]
Message-ID: <20251113155127.591195-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251113155127.591195-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   | 45 ++++++++++++++++++++++++++-----
 2 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index f1f715eb..cf5e2a0f 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;
                 },
             },
@@ -214,6 +220,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 1fa2f7fa..ff4a7545 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -33,23 +33,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;
@@ -133,6 +149,22 @@ 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 +215,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.47.3



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


  parent reply	other threads:[~2025-11-13 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 15:51 [pve-devel] [PATCH-SERIES qemu-server/manager/docs v2 0/3] close #5291: " Fiona Ebner
2025-11-13 15:51 ` [pve-devel] [PATCH qemu-server v2 1/3] " Fiona Ebner
2025-11-13 15:51 ` Fiona Ebner [this message]
2025-11-13 15:51 ` [pve-devel] [PATCH docs v2 3/3] kernel samepage merging: describe how to disable for a specific VM Fiona Ebner

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=20251113155127.591195-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal