+// The view model of the parent shoul contain a 'cgroupMode' variable (or params for v2 are used).
Ext.define('PVE.qemu.ProcessorInputPanel', {
extend: 'Proxmox.panel.InputPanel',
alias: 'widget.pveQemuProcessorPanel',
socketCount: 1,
coreCount: 1,
showCustomModelPermWarning: false,
+ userIsRoot: false,
},
formulas: {
totalCoreCount: get => get('socketCount') * get('coreCount'),
+ cpuunitsDefault: (get) => get('cgroupMode') === 1 ? 1024 : 100,
+ cpuunitsMin: (get) => get('cgroupMode') === 1 ? 2 : 1,
+ cpuunitsMax: (get) => get('cgroupMode') === 1 ? 262144 : 10000,
},
},
controller: {
xclass: 'Ext.app.ViewController',
+ init: function() {
+ let me = this;
+ let viewModel = me.getViewModel();
+
+ viewModel.set('userIsRoot', Proxmox.UserName === 'root@pam');
+ },
},
onGetValues: function(values) {
- var me = this;
+ let me = this;
+ let cpuunitsDefault = me.getViewModel().get('cpuunitsDefault');
if (Array.isArray(values.delete)) {
values.delete = values.delete.join(',');
}
- PVE.Utils.delete_if_default(values, 'cpulimit', '0', 0);
- PVE.Utils.delete_if_default(values, 'cpuunits', '1024', 0);
+ PVE.Utils.delete_if_default(values, 'cpulimit', '0', me.insideWizard);
+ PVE.Utils.delete_if_default(values, 'cpuunits', `${cpuunitsDefault}`, me.insideWizard);
// build the cpu options:
me.cpu.cputype = values.cputype;
xtype: 'proxmoxintegerfield',
name: 'cores',
minValue: 1,
- maxValue: 128,
+ maxValue: 256,
value: '1',
fieldLabel: gettext('Cores'),
allowBlank: false,
allowBlank: true,
emptyText: gettext('unlimited'),
},
+ {
+ xtype: 'proxmoxtextfield',
+ name: 'affinity',
+ vtype: 'CpuSet',
+ value: '',
+ fieldLabel: gettext('CPU Affinity'),
+ allowBlank: true,
+ emptyText: gettext("All Cores"),
+ deleteEmpty: true,
+ bind: {
+ disabled: '{!userIsRoot}',
+ },
+ },
],
advancedColumn2: [
xtype: 'proxmoxintegerfield',
name: 'cpuunits',
fieldLabel: gettext('CPU units'),
- // FIXME: change to [1, 1000] once cgroup v1 support gets removed (PVE 8 ?)
- minValue: 2,
- maxValue: 262144,
- value: '1024',
+ minValue: '1',
+ maxValue: '10000',
+ value: '',
+ emptyText: '100',
+ bind: {
+ minValue: '{cpuunitsMin}',
+ maxValue: '{cpuunitsMax}',
+ emptyText: '{cpuunitsDefault}',
+ },
deleteEmpty: true,
allowBlank: true,
},
Ext.define('PVE.qemu.ProcessorEdit', {
extend: 'Proxmox.window.Edit',
+ alias: 'widget.pveQemuProcessorEdit',
width: 700,
+ viewModel: {
+ data: {
+ cgroupMode: 2,
+ },
+ },
+
initComponent: function() {
- var me = this;
+ let me = this;
+ me.getViewModel().set('cgroupMode', me.cgroupMode);
var ipanel = Ext.create('PVE.qemu.ProcessorInputPanel');