[pve-devel] [PATCH manager] gui: qemu: fix min/max memory checks
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Aug 21 10:39:01 CEST 2019
On 8/20/19 2:50 PM, Dominik Csapak wrote:
> we need to set the minvalue for the memoryfield when setting the
> 'mininum memory', otherwise it is possible in the wizard to set
> a higher minimum than maximum value
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> www/manager6/qemu/MemoryEdit.js | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
> index 4c4d1815..ab578bef 100644
> --- a/www/manager6/qemu/MemoryEdit.js
> +++ b/www/manager6/qemu/MemoryEdit.js
> @@ -67,9 +67,11 @@ 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=memory]');
> var shares = me.down('field[name=shares]');
> - shares.setDisabled(value === memory);
> + shares.setDisabled(value === memory.getValue());
> + memory.setMinValue(value);
> + memory.validate();
> }
> }
> },
>
With this I cannot use the spin-down trigger/button in the memory field
if it's the same (or less) as the minimum value, that worked before -
with correct behavior (both, memory and minimum got decreased).
I'd like to keep this behavior, IMO it's nicer UX, as it's really strange
and seems like a bug if the "advanced" mode is off and thus the minimum
field isn't even visible.
SO, the correct fix would IMO be:
----8<----
diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 4c4d1815..d1284716 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -60,6 +60,7 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
xtype: 'pveMemoryField',
name: 'balloon',
minValue: 1,
+ maxValue: 512,
step: 32,
fieldLabel: gettext('Minimum memory') + ' (MiB)',
hotplug: me.hotplug,
--
This ensures the default maxValue is initially correct, after that
the memory change handler does the rest. What do you think?
More information about the pve-devel
mailing list