From: Alexandre Derumier <aderumier@odiso.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 2/2] ui: qemu : memoryedit: add new max && virtio fields
Date: Mon, 20 Feb 2023 17:27:29 +0100 [thread overview]
Message-ID: <20230220162729.1907695-3-aderumier@odiso.com> (raw)
In-Reply-To: <20230220162729.1907695-1-aderumier@odiso.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
www/manager6/qemu/MemoryEdit.js | 52 +++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 9 deletions(-)
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 5e91dc9b..be7903a2 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -20,12 +20,12 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
let me = this;
let view = me.getView(), viewModel = me.getViewModel();
if (view.insideWizard) {
- let memory = view.down('pveMemoryField[name=memory]');
+ let current = view.down('pveMemoryField[name=current]');
// NOTE: we only set memory but that then sets balloon in its change handler
if (viewModel.get('current.ostype') === 'win11') {
- memory.setValue('4096');
+ current.setValue('4096');
} else {
- memory.setValue('2048');
+ current.setValue('2048');
}
}
},
@@ -36,13 +36,23 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
var res = {};
- res.memory = values.memory;
+ let memory = {};
+ memory.current = values.current;
+ if (values.max && values.max !== 0) {
+ memory.max = values.max;
+ }
+ if (values.virtio) {
+ memory.virtio = values.virtio;
+ }
+
+ res.memory = PVE.Parser.printPropertyString(memory, 'current');
+
res.balloon = values.balloon;
if (!values.ballooning) {
res.balloon = 0;
res.delete = 'shares';
- } else if (values.memory === values.balloon) {
+ } else if (values.current === values.balloon) {
delete res.balloon;
res.delete = 'balloon,shares';
} else if (Ext.isDefined(values.shares) && values.shares !== "") {
@@ -63,7 +73,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
xtype: 'pveMemoryField',
labelWidth: labelWidth,
fieldLabel: gettext('Memory') + ' (MiB)',
- name: 'memory',
+ name: 'current',
value: '512', // better defaults get set via the view controllers afterrender
minValue: 1,
step: 32,
@@ -96,12 +106,25 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
allowBlank: false,
listeners: {
change: function(f, value) {
- var memory = me.down('field[name=memory]').getValue();
+ var memory = me.down('field[name=current]').getValue();
var shares = me.down('field[name=shares]');
shares.setDisabled(value === memory);
},
},
},
+ {
+ xtype: 'pveMemoryField',
+ name: 'max',
+ minValue: 65536,
+ maxValue: 4194304,
+ value: '',
+ step: 65536,
+ fieldLabel: gettext('Maximum memory') + ' (MiB)',
+ labelWidth: labelWidth,
+ allowBlank: true,
+ emptyText: gettext('Disabled'),
+ submitEmptyText: false,
+ },
{
xtype: 'proxmoxintegerfield',
name: 'shares',
@@ -132,6 +155,13 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
},
},
},
+ {
+ xtype: 'proxmoxcheckbox',
+ labelWidth: labelWidth,
+ name: 'virtio',
+ defaultValue: 0,
+ fieldLabel: gettext('Virtiomem'),
+ },
];
if (me.insideWizard) {
@@ -178,11 +208,15 @@ Ext.define('PVE.qemu.MemoryEdit', {
success: function(response, options) {
var data = response.result.data;
+ let memory = PVE.Parser.parsePropertyString(data.memory, 'current');
+
var values = {
ballooning: data.balloon === 0 ? '0' : '1',
shares: data.shares,
- memory: data.memory || '512',
- balloon: data.balloon > 0 ? data.balloon : data.memory || '512',
+ current: memory.current || '512',
+ max: memory.max || '',
+ virtio: memory.virtio,
+ balloon: data.balloon > 0 ? data.balloon : memory.current || '512',
};
ipanel.setValues(values);
--
2.30.2
prev parent reply other threads:[~2023-02-20 16:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 16:27 [pve-devel] [PATCH pve-manager 0/2] ui: add support for new memory format Alexandre Derumier
2023-02-20 16:27 ` [pve-devel] [PATCH pve-manager 1/2] ui: qemu: hardware: add new memory format support Alexandre Derumier
2023-02-20 16:27 ` Alexandre Derumier [this message]
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=20230220162729.1907695-3-aderumier@odiso.com \
--to=aderumier@odiso.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