* [pve-devel] [PATCH pve-manager 1/2] ui: qemu: hardware: add new memory format support
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 ` Alexandre Derumier
2023-02-20 16:27 ` [pve-devel] [PATCH pve-manager 2/2] ui: qemu : memoryedit: add new max && virtio fields Alexandre Derumier
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Derumier @ 2023-02-20 16:27 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
www/manager6/qemu/HardwareView.js | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index af35a980..0b17ef0d 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -77,11 +77,17 @@ Ext.define('PVE.qemu.HardwareView', {
renderer: function(value, metaData, record, ri, ci, store, pending) {
var res = '';
- var max = me.getObjectValue('memory', 512, pending);
+ let memory = me.getObjectValue('memory', undefined, pending);
+ let props = PVE.Parser.parsePropertyString(memory, 'current');
+ let current = 512;
+ if (props.current) {
+ current = props.current;
+ }
+
var balloon = me.getObjectValue('balloon', undefined, pending);
var shares = me.getObjectValue('shares', undefined, pending);
- res = Proxmox.Utils.format_size(max*1024*1024);
+ res = Proxmox.Utils.format_size(current*1024*1024);
if (balloon !== undefined && balloon > 0) {
res = Proxmox.Utils.format_size(balloon*1024*1024) + "/" + res;
@@ -92,6 +98,13 @@ Ext.define('PVE.qemu.HardwareView', {
} else if (balloon === 0) {
res += ' [balloon=0]';
}
+ if (props.max) {
+ res += ' [max=' + Proxmox.Utils.format_size(props.max*1024*1024) +']';
+ }
+ if (props.virtio) {
+ res += ' [virtio=' + props.virtio +']';
+ }
+
return res;
},
},
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH pve-manager 2/2] ui: qemu : memoryedit: add new max && virtio fields
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
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Derumier @ 2023-02-20 16:27 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread