]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/form/VMCPUFlagSelector.js
1 /*jslint confusion: true*/
2 Ext
.define('PVE.form.VMCPUFlagSelector', {
3 extend
: 'Ext.grid.Panel',
4 alias
: 'widget.vmcpuflagselector',
7 field
: 'Ext.form.field.Field'
10 disableSelection
: true,
22 fields
: ['flag', { name
: 'state', defaultValue
: '=' }, 'desc'],
24 // FIXME: let qemu-server host this and autogenerate or get from API call??
25 { flag
: 'md-clear', desc
: 'Required to let the guest OS know if MDS is mitigated correctly' },
26 { flag
: 'pcid', desc
: 'Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs' },
27 { flag
: 'spec-ctrl', desc
: 'Allows improved Spectre mitigation with Intel CPUs' },
28 { flag
: 'ssbd', desc
: 'Protection for "Speculative Store Bypass" for Intel models' },
29 { flag
: 'ibpb', desc
: 'Allows improved Spectre mitigation with AMD CPUs' },
30 { flag
: 'virt-ssbd', desc
: 'Basis for "Speculative Store Bypass" protection for AMD models' },
31 { flag
: 'amd-ssbd', desc
: 'Improves Spectre mitigation performance with AMD CPUs, best used with "virt-ssbd"' },
32 { flag
: 'amd-no-ssb', desc
: 'Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs' },
33 { flag
: 'pdpe1gb', desc
: 'Allow guest OS to use 1GB size pages, if host HW supports it' },
34 { flag
: 'hv-tlbflush', desc
: 'Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.' },
35 { flag
: 'hv-evmcs', desc
: 'Improve performance for nested virtualization. Only supported on Intel CPUs.' },
36 { flag
: 'aes', desc
: 'Activate AES instruction set for HW acceleration.' }
45 getValue: function() {
47 var store
= me
.getStore();
50 // ExtJS does not has a nice getAllRecords interface for stores :/
51 store
.queryBy(Ext
.returnTrue
).each(function(rec
) {
52 var s
= rec
.get('state');
54 var f
= rec
.get('flag');
63 flags
+= me
.unkownFlags
.join(';');
68 setValue: function(value
) {
70 var store
= me
.getStore();
72 me
.value
= value
|| '';
76 me
.getStore().queryBy(Ext
.returnTrue
).each(function(rec
) {
77 rec
.set('state', '=');
80 var flags
= value
? value
.split(';') : [];
81 flags
.forEach(function(flag
) {
82 var sign
= flag
.substr(0, 1);
83 flag
= flag
.substr(1);
85 var rec
= store
.findRecord('flag', flag
);
87 rec
.set('state', sign
);
89 me
.unkownFlags
.push(flag
);
94 var res
= me
.mixins
.field
.setValue
.call(me
, value
);
101 renderer: function(v
) {
103 case '=': return 'Default';
104 case '-': return 'Off';
105 case '+': return 'On';
106 default: return 'Unknown';
112 xtype
: 'widgetcolumn',
115 onWidgetAttach: function (column
, widget
, record
) {
116 var val
= record
.get('state') || '=';
117 widget
.down('[inputValue=' + val
+ ']').setValue(true);
118 // TODO: disable if selected CPU model and flag are incompatible
124 validateOnChange
: false,
127 change: function(f
, value
) {
128 var v
= Object
.values(value
)[0];
129 f
.getWidgetRecord().set('state', v
);
131 var view
= this.up('grid');
132 view
.dirty
= view
.getValue() !== view
.originalValue
;
134 //view.checkChange();
140 boxLabelAlign
: 'before',
165 initComponent: function() {
168 // static class store, thus gets not recreated, so ensure defaults are set!
169 me
.getStore().data
.forEach(function(v
) {
173 me
.value
= me
.originalValue
= '';
175 me
.callParent(arguments
);