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 if (values
.affinity
=== undefined ||
31 values
.affinity
=== null ||
32 values
.affinity
=== '') {
33 if (values
.delete.length
> 0) {
34 values
.delete = values
.delete + ",affinity";
36 values
.delete = "affinity";
38 delete values
.affinity
;
41 PVE
.Utils
.delete_if_default(values
, 'cpulimit', '0', me
.insideWizard
);
42 PVE
.Utils
.delete_if_default(values
, 'cpuunits', '1024', me
.insideWizard
);
44 // build the cpu options:
45 me
.cpu
.cputype
= values
.cputype
;
48 me
.cpu
.flags
= values
.flags
;
53 delete values
.cputype
;
55 var cpustring
= PVE
.Parser
.printQemuCpu(me
.cpu
);
57 // remove cputype delete request:
58 var del
= values
.delete;
62 Ext
.Array
.remove(del
, 'cputype');
68 values
.cpu
= cpustring
;
73 var delarr
= del
.join(',');
75 values
.delete = delarr
;
81 setValues: function(values
) {
84 let type
= values
.cputype
;
85 let typeSelector
= me
.lookupReference('cputype');
86 let typeStore
= typeSelector
.getStore();
87 typeStore
.on('load', (store
, records
, success
) => {
88 if (!success
|| !type
|| records
.some(x
=> x
.data
.name
=== type
)) {
92 // if we get here, a custom CPU model is selected for the VM but we
93 // don't have permission to configure it - it will not be in the
94 // list retrieved from the API, so add it manually to allow changing
95 // other processor options
98 displayname
: type
.replace(/^custom-/, ''),
100 vendor
: gettext("Unknown"),
102 typeSelector
.select(type
);
105 me
.callParent([values
]);
112 xtype
: 'proxmoxintegerfield',
117 fieldLabel
: gettext('Sockets'),
120 value
: '{socketCount}',
124 xtype
: 'proxmoxintegerfield',
129 fieldLabel
: gettext('Cores'),
132 value
: '{coreCount}',
139 xtype
: 'CPUModelSelector',
141 reference
: 'cputype',
142 fieldLabel
: gettext('Type'),
145 xtype
: 'displayfield',
146 fieldLabel
: gettext('Total cores'),
150 value
: '{totalCoreCount}',
157 xtype
: 'displayfield',
159 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!'),
162 hidden
: '{!showCustomModelPermWarning}',
169 xtype
: 'proxmoxintegerfield',
174 fieldLabel
: gettext('VCPUs'),
179 emptyText
: '{totalCoreCount}',
180 maxValue
: '{totalCoreCount}',
184 xtype
: 'numberfield',
187 maxValue
: 128, // api maximum
190 fieldLabel
: gettext('CPU limit'),
192 emptyText
: gettext('unlimited'),
199 fieldLabel
: gettext('CPU affinity'),
201 emptyText
: gettext("all cores"),
210 xtype
: 'proxmoxintegerfield',
212 fieldLabel
: gettext('CPU units'),
213 // FIXME: change to [1, 1000] once cgroup v1 support gets removed (PVE 8 ?)
222 xtype
: 'proxmoxcheckbox',
223 fieldLabel
: gettext('Enable NUMA'),
231 text
: 'Extra CPU Flags:',
234 xtype
: 'vmcpuflagselector',
240 Ext
.define('PVE.qemu.ProcessorEdit', {
241 extend
: 'Proxmox.window.Edit',
245 initComponent: function() {
248 var ipanel
= Ext
.create('PVE.qemu.ProcessorInputPanel');
251 subject
: gettext('Processors'),
258 success: function(response
, options
) {
259 var data
= response
.result
.data
;
260 var value
= data
.cpu
;
262 var cpu
= PVE
.Parser
.parseQemuCpu(value
);
264 data
.cputype
= cpu
.cputype
;
266 data
.flags
= cpu
.flags
;
269 let caps
= Ext
.state
.Manager
.get('GuiCap');
270 if (data
.cputype
.indexOf('custom-') === 0 &&
271 !caps
.nodes
['Sys.Audit']) {
272 let vm
= ipanel
.getViewModel();
273 vm
.set("showCustomModelPermWarning", true);