1 Ext
.define('PVE.qemu.ProcessorInputPanel', {
2 extend
: 'Proxmox.panel.InputPanel',
3 alias
: 'widget.pveQemuProcessorPanel',
12 showCustomModelPermWarning
: false,
15 totalCoreCount
: get => get('socketCount') * get('coreCount'),
20 xclass
: 'Ext.app.ViewController',
23 onGetValues: function(values
) {
26 if (Array
.isArray(values
.delete)) {
27 values
.delete = values
.delete.join(',');
30 PVE
.Utils
.delete_if_default(values
, 'cpulimit', '0', me
.insideWizard
);
31 PVE
.Utils
.delete_if_default(values
, 'cpuunits', '1024', me
.insideWizard
);
33 // build the cpu options:
34 me
.cpu
.cputype
= values
.cputype
;
37 me
.cpu
.flags
= values
.flags
;
42 delete values
.cputype
;
44 var cpustring
= PVE
.Parser
.printQemuCpu(me
.cpu
);
46 // remove cputype delete request:
47 var del
= values
.delete;
51 Ext
.Array
.remove(del
, 'cputype');
57 values
.cpu
= cpustring
;
62 var delarr
= del
.join(',');
64 values
.delete = delarr
;
70 setValues: function(values
) {
73 let type
= values
.cputype
;
74 let typeSelector
= me
.lookupReference('cputype');
75 let typeStore
= typeSelector
.getStore();
76 typeStore
.on('load', (store
, records
, success
) => {
77 if (!success
|| !type
|| records
.some(x
=> x
.data
.name
=== type
)) {
81 // if we get here, a custom CPU model is selected for the VM but we
82 // don't have permission to configure it - it will not be in the
83 // list retrieved from the API, so add it manually to allow changing
84 // other processor options
87 displayname
: type
.replace(/^custom-/, ''),
89 vendor
: gettext("Unknown"),
91 typeSelector
.select(type
);
94 me
.callParent([values
]);
101 xtype
: 'proxmoxintegerfield',
106 fieldLabel
: gettext('Sockets'),
109 value
: '{socketCount}',
113 xtype
: 'proxmoxintegerfield',
118 fieldLabel
: gettext('Cores'),
121 value
: '{coreCount}',
128 xtype
: 'CPUModelSelector',
130 reference
: 'cputype',
131 fieldLabel
: gettext('Type'),
134 xtype
: 'displayfield',
135 fieldLabel
: gettext('Total cores'),
139 value
: '{totalCoreCount}',
146 xtype
: 'displayfield',
148 value
: gettext('WARNING: You do not have permission to configure custom CPU types, if you change the type you will not be able to go back!'),
151 hidden
: '{!showCustomModelPermWarning}',
158 xtype
: 'proxmoxintegerfield',
163 fieldLabel
: gettext('VCPUs'),
168 emptyText
: '{totalCoreCount}',
169 maxValue
: '{totalCoreCount}',
173 xtype
: 'numberfield',
176 maxValue
: 128, // api maximum
179 fieldLabel
: gettext('CPU limit'),
181 emptyText
: gettext('unlimited'),
187 xtype
: 'proxmoxintegerfield',
189 fieldLabel
: gettext('CPU units'),
190 // FIXME: change to [1, 1000] once cgroup v1 support gets removed (PVE 8 ?)
199 xtype
: 'proxmoxcheckbox',
200 fieldLabel
: gettext('Enable NUMA'),
208 text
: 'Extra CPU Flags:',
211 xtype
: 'vmcpuflagselector',
217 Ext
.define('PVE.qemu.ProcessorEdit', {
218 extend
: 'Proxmox.window.Edit',
222 initComponent: function() {
225 var ipanel
= Ext
.create('PVE.qemu.ProcessorInputPanel');
228 subject
: gettext('Processors'),
235 success: function(response
, options
) {
236 var data
= response
.result
.data
;
237 var value
= data
.cpu
;
239 var cpu
= PVE
.Parser
.parseQemuCpu(value
);
241 data
.cputype
= cpu
.cputype
;
243 data
.flags
= cpu
.flags
;
246 let caps
= Ext
.state
.Manager
.get('GuiCap');
247 if (data
.cputype
.indexOf('custom-') === 0 &&
248 !caps
.nodes
['Sys.Audit']) {
249 let vm
= ipanel
.getViewModel();
250 vm
.set("showCustomModelPermWarning", true);