vmconfig: {}, // used to select usused disks
- viewModel: {},
+ viewModel: {
+ data: {
+ isSCSI: false,
+ isVirtIO: false,
+ isSCSISingle: false,
+ },
+ },
controller: {
-
xclass: 'Ext.app.ViewController',
onControllerChange: function(field) {
let me = this;
- var value = field.getValue();
+ let vm = this.getViewModel();
- var allowIOthread = value.match(/^(virtio|scsi)/);
- me.lookup('iothread').setDisabled(!allowIOthread);
- if (!allowIOthread) {
- me.lookup('iothread').setValue(false);
- }
+ let value = field.getValue();
+ vm.set('isSCSI', value.match(/^scsi/));
+ vm.set('isVirtIO', value.match(/^virtio/));
- var virtio = value.match(/^virtio/);
- me.lookup('ssd').setDisabled(virtio);
- if (virtio) {
- me.lookup('ssd').setValue(false);
- }
+ me.fireIdChange();
+ },
- me.lookup('scsiController').setVisible(value.match(/^scsi/));
+ fireIdChange: function() {
+ let view = this.getView();
+ view.fireEvent('diskidchange', view, view.bussel.getConfId());
},
control: {
change: 'onControllerChange',
afterrender: 'onControllerChange',
},
- 'field[name=iothread]': {
+ 'field[name=deviceid]': {
+ change: 'fireIdChange',
+ },
+ 'field[name=scsiController]': {
change: function(f, value) {
- if (!this.getView().insideWizard) {
- return;
- }
- var vmScsiType = value ? 'virtio-scsi-single': 'virtio-scsi-pci';
- this.lookupReference('scsiController').setValue(vmScsiType);
+ let vm = this.getViewModel();
+ vm.set('isSCSISingle', value === 'virtio-scsi-single');
},
},
},
if (view.isCreate) {
vm.set('isIncludedInBackup', true);
}
+ if (view.confid) {
+ vm.set('isSCSI', view.confid.match(/^scsi/));
+ vm.set('isVirtIO', view.confid.match(/^virtio/));
+ }
},
},
PVE.Utils.propertyStringSet(me.drive, values.discard, 'discard', 'on');
PVE.Utils.propertyStringSet(me.drive, values.ssd, 'ssd', 'on');
PVE.Utils.propertyStringSet(me.drive, values.iothread, 'iothread', 'on');
+ PVE.Utils.propertyStringSet(me.drive, values.readOnly, 'ro', 'on');
PVE.Utils.propertyStringSet(me.drive, values.cache, 'cache');
+ PVE.Utils.propertyStringSet(me.drive, values.aio, 'aio');
- var names = ['mbps_rd', 'mbps_wr', 'iops_rd', 'iops_wr'];
- Ext.Array.each(names, function(name) {
- var burst_name = name + '_max';
+ ['mbps_rd', 'mbps_wr', 'iops_rd', 'iops_wr'].forEach(name => {
+ let burst_name = `${name}_max`;
PVE.Utils.propertyStringSet(me.drive, values[name], name);
PVE.Utils.propertyStringSet(me.drive, values[burst_name], burst_name);
- });
-
+ });
params[confid] = PVE.Parser.printQemuDrive(me.drive);
return params;
},
+ updateVMConfig: function(vmconfig) {
+ var me = this;
+ me.vmconfig = vmconfig;
+ me.bussel?.updateVMConfig(vmconfig);
+ },
+
setVMConfig: function(vmconfig) {
var me = this;
values.discard = drive.discard === 'on';
values.ssd = PVE.Parser.parseBoolean(drive.ssd);
values.iothread = PVE.Parser.parseBoolean(drive.iothread);
+ values.readOnly = PVE.Parser.parseBoolean(drive.ro);
+ values.aio = drive.aio || '__default__';
values.mbps_rd = drive.mbps_rd;
values.mbps_wr = drive.mbps_wr;
initComponent: function() {
var me = this;
- var labelWidth = 140;
-
me.drive = {};
let column1 = [];
if (!me.confid || me.unused) {
me.bussel = Ext.create('PVE.form.ControllerSelector', {
- vmconfig: me.insideWizard ? { ide2: 'cdrom' } : {},
+ vmconfig: me.vmconfig,
+ selectFree: true,
});
column1.push(me.bussel);
me.scsiController = Ext.create('Ext.form.field.Display', {
fieldLabel: gettext('SCSI Controller'),
reference: 'scsiController',
+ name: 'scsiController',
bind: me.insideWizard ? {
value: '{current.scsihw}',
- } : undefined,
+ visible: '{isSCSI}',
+ } : {
+ visible: '{isSCSI}',
+ },
renderer: PVE.Utils.render_scsihw,
submitValue: false,
hidden: true,
reference: 'discard',
name: 'discard',
},
+ {
+ xtype: 'proxmoxcheckbox',
+ name: 'iothread',
+ fieldLabel: 'IO thread',
+ clearOnDisable: true,
+ bind: me.insideWizard || me.isCreate ? {
+ disabled: '{!isVirtIO && !isSCSI}',
+ // Checkbox.setValue handles Arrays in a different way, therefore cast to bool
+ value: '{!!isVirtIO || (isSCSI && isSCSISingle)}',
+ } : {
+ disabled: '{!isVirtIO && !isSCSI}',
+ },
+ },
);
advancedColumn1.push(
{
xtype: 'proxmoxcheckbox',
- disabled: me.confid && me.confid.match(/^virtio/),
fieldLabel: gettext('SSD emulation'),
- labelWidth: labelWidth,
name: 'ssd',
- reference: 'ssd',
+ clearOnDisable: true,
+ bind: {
+ disabled: '{isVirtIO}',
+ },
},
{
xtype: 'proxmoxcheckbox',
- disabled: me.confid && !me.confid.match(/^(virtio|scsi)/),
- fieldLabel: 'IO thread',
- labelWidth: labelWidth,
- reference: 'iothread',
- name: 'iothread',
+ name: 'readOnly', // `ro` in the config, we map in get/set values
+ defaultValue: 0,
+ fieldLabel: gettext('Read-only'),
+ clearOnDisable: true,
+ bind: {
+ disabled: '{!isVirtIO && !isSCSI}',
+ },
},
);
tag: 'div',
'data-qtip': gettext('Include volume in backup job'),
},
- labelWidth: labelWidth,
name: 'backup',
bind: {
value: '{isIncludedInBackup}',
{
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Skip replication'),
- labelWidth: labelWidth,
name: 'noreplicate',
},
+ {
+ xtype: 'proxmoxKVComboBox',
+ name: 'aio',
+ fieldLabel: gettext('Async IO'),
+ allowBlank: false,
+ value: '__default__',
+ comboItems: [
+ ['__default__', Proxmox.Utils.defaultText + ' (io_uring)'],
+ ['io_uring', 'io_uring'],
+ ['native', 'native'],
+ ['threads', 'threads'],
+ ],
+ },
);
+ let labelWidth = 140;
+
let bwColumn1 = [
{
xtype: 'numberfield',