From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B833AA25C4 for ; Mon, 19 Jun 2023 09:29:26 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9B1BC25400 for ; Mon, 19 Jun 2023 09:28:56 +0200 (CEST) Received: from bastionodiso.odiso.net (bastionodiso.odiso.net [185.151.191.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 19 Jun 2023 09:28:54 +0200 (CEST) Received: from kvmformation3.odiso.net (formationkvm3.odiso.net [10.3.94.12]) by bastionodiso.odiso.net (Postfix) with ESMTP id 43ABD7E81; Mon, 19 Jun 2023 09:28:45 +0200 (CEST) Received: by kvmformation3.odiso.net (Postfix, from userid 0) id 3B460241619; Mon, 19 Jun 2023 09:28:45 +0200 (CEST) From: Alexandre Derumier To: pve-devel@lists.proxmox.com Date: Mon, 19 Jun 2023 09:28:33 +0200 Message-Id: <20230619072841.38531-5-aderumier@odiso.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230619072841.38531-1-aderumier@odiso.com> References: <20230619072841.38531-1-aderumier@odiso.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy HEADER_FROM_DIFFERENT_DOMAINS 0.25 From and EnvelopeFrom 2nd level mail domains are different KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH v2 pve-manager 2/2] ui: qemu : memoryedit: add new max && virtio fields X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jun 2023 07:29:26 -0000 Signed-off-by: Alexandre Derumier --- 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.39.2