[pve-devel] [PATCH manager] ui: MachineEdit with viommu checkbox
Dominik Csapak
d.csapak at proxmox.com
Mon Oct 24 16:22:11 CEST 2022
comments inline:
On 9/21/22 11:07, Markus Frank wrote:
> Added a Checkbox to enable viommu, if q35 is selected.
> Otherwise (i440fx) the checkbox is disabled.
>
> The UI also needs to parse the new machine parameter as PropertyString.
>
> Signed-off-by: Markus Frank <m.frank at proxmox.com>
> ---
> www/manager6/qemu/MachineEdit.js | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
> index f928c80c..25661106 100644
> --- a/www/manager6/qemu/MachineEdit.js
> +++ b/www/manager6/qemu/MachineEdit.js
> @@ -17,6 +17,12 @@ Ext.define('PVE.qemu.MachineInputPanel', {
> let type = value === 'q35' ? 'q35' : 'i440fx';
> store.clearFilter();
> store.addFilter(val => val.data.id === 'latest' || val.data.type === type);
> + if (type === 'i440fx') {
> + me.lookup('viommu').setValue(false);
> + me.lookup('viommu').setDisabled(true);
> + } else {
> + me.lookup('viommu').setDisabled(false);
> + }
> if (!me.getView().isWindows) {
> version.setValue('latest');
> } else {
> @@ -40,12 +46,17 @@ Ext.define('PVE.qemu.MachineInputPanel', {
> delete values.delete;
> }
> delete values.version;
> + if (values.viommu) values.machine += ",viommu=1";
not really our style. we want {} and multiline if statements, see
https://pve.proxmox.com/wiki/Javascript_Style_Guide
> + delete values.viommu;
> return values;
> },
>
> setValues: function(values) {
> let me = this;
>
> + let machine_conf = PVE.Parser.parsePropertyString(values.machine, "type");
> + values.machine = machine_conf.type;
> +
> me.isWindows = values.isWindows;
> if (values.machine === 'pc') {
> values.machine = '__default__';
> @@ -54,10 +65,14 @@ Ext.define('PVE.qemu.MachineInputPanel', {
> if (me.isWindows) {
> if (values.machine === '__default__') {
> values.version = 'pc-i440fx-5.1';
> + values.viommu = false;
> } else if (values.machine === 'q35') {
> values.version = 'pc-q35-5.1';
> }
> }
> +
> + values.viommu = machine_conf.viommu === "1";
> +
> if (values.machine !== '__default__' && values.machine !== 'q35') {
> values.version = values.machine;
> values.machine = values.version.match(/q35/) ? 'q35' : '__default__';
> @@ -108,6 +123,12 @@ Ext.define('PVE.qemu.MachineInputPanel', {
> },
> },
> },
> + {
> + xtype: 'proxmoxcheckbox',
> + fieldLabel: gettext('vIOMMU'),
> + name: 'viommu',
> + reference: 'viommu',
> + },
> {
> xtype: 'displayfield',
> fieldLabel: gettext('Note'),
More information about the pve-devel
mailing list