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', 0);
31 PVE
.Utils
.delete_if_default(values
, 'cpuunits', '1024', 0);
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'];
48 delete 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'),
197 xtype
: 'proxmoxcheckbox',
198 fieldLabel
: gettext('Enable NUMA'),
206 text
: 'Extra CPU Flags:'
209 xtype
: 'vmcpuflagselector',
215 Ext
.define('PVE.qemu.ProcessorEdit', {
216 extend
: 'Proxmox.window.Edit',
220 initComponent : function() {
223 var ipanel
= Ext
.create('PVE.qemu.ProcessorInputPanel');
226 subject
: gettext('Processors'),
233 success: function(response
, options
) {
234 var data
= response
.result
.data
;
235 var value
= data
.cpu
;
237 var cpu
= PVE
.Parser
.parseQemuCpu(value
);
239 data
.cputype
= cpu
.cputype
;
241 data
.flags
= cpu
.flags
;
244 let caps
= Ext
.state
.Manager
.get('GuiCap');
245 if (data
.cputype
.indexOf('custom-') === 0 &&
246 !caps
.nodes
['Sys.Audit'])
248 let vm
= ipanel
.getViewModel();
249 vm
.set("showCustomModelPermWarning", true);