From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 3D7429610B for ; Mon, 15 Apr 2024 10:50:11 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1EC9C5902 for ; Mon, 15 Apr 2024 10:50:11 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 15 Apr 2024 10:50:10 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 620CF447F7 for ; Mon, 15 Apr 2024 10:50:10 +0200 (CEST) From: Markus Frank To: pve-devel@lists.proxmox.com Date: Mon, 15 Apr 2024 10:50:01 +0200 Message-Id: <20240415085002.665246-1-m.frank@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.032 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v10 1/2] ui: machine: add viommu ComboBox X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2024 08:50:11 -0000 Added a proxmoxKVComboBox for selecting a vIOMMU implementation for a VM. If i440fx is selected, another ComboBox will be enabled/visible that does not have the Intel option, as Intel-vIOMMU is not compatible with i440fx. Uses the new machine property-string from the qemu-server's "config: define machine schema as property-string" commit and the viommu option added in the qemu-server's "fix #3784: config: Parameter for guest vIOMMU + test-cases" commit. Signed-off-by: Markus Frank --- www/manager6/qemu/MachineEdit.js | 62 +++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js index f928c80c..48c72c1d 100644 --- a/www/manager6/qemu/MachineEdit.js +++ b/www/manager6/qemu/MachineEdit.js @@ -2,6 +2,15 @@ Ext.define('PVE.qemu.MachineInputPanel', { extend: 'Proxmox.panel.InputPanel', xtype: 'pveMachineInputPanel', + viewModel: { + data: { + type: '__default__', + }, + formulas: { + q35: get => get('type') === 'q35', + }, + }, + controller: { xclass: 'Ext.app.ViewController', control: { @@ -35,17 +44,29 @@ Ext.define('PVE.qemu.MachineInputPanel', { }, onGetValues: function(values) { + if (values.delete === 'machine' && values.viommu) { + delete values.delete; + values.machine = 'pc'; + } if (values.version && values.version !== 'latest') { values.machine = values.version; delete values.delete; } delete values.version; - return values; + if (values.delete === 'machine' && !values.viommu) { + return values; + } + let ret = {}; + ret.machine = PVE.Parser.printPropertyString(values, 'machine'); + return ret; }, setValues: function(values) { let me = this; + let machineConf = PVE.Parser.parsePropertyString(values.machine, 'type'); + values.machine = machineConf.type; + me.isWindows = values.isWindows; if (values.machine === 'pc') { values.machine = '__default__'; @@ -58,6 +79,9 @@ Ext.define('PVE.qemu.MachineInputPanel', { values.version = 'pc-q35-5.1'; } } + + values.viommu = machineConf.viommu || '__default__'; + if (values.machine !== '__default__' && values.machine !== 'q35') { values.version = values.machine; values.machine = values.version.match(/q35/) ? 'q35' : '__default__'; @@ -78,6 +102,9 @@ Ext.define('PVE.qemu.MachineInputPanel', { ['__default__', PVE.Utils.render_qemu_machine('')], ['q35', 'q35'], ], + bind: { + value: '{type}', + }, }, advancedItems: [ @@ -113,6 +140,39 @@ Ext.define('PVE.qemu.MachineInputPanel', { fieldLabel: gettext('Note'), value: gettext('Machine version change may affect hardware layout and settings in the guest OS.'), }, + { + xtype: 'proxmoxKVComboBox', + name: 'viommu', + fieldLabel: gettext('vIOMMU'), + reference: 'viommu-q35', + deleteEmpty: false, + value: '__default__', + comboItems: [ + ['__default__', Proxmox.Utils.defaultText + ' (None)'], + ['intel', 'Intel'], + ['virtio', 'VirtIO'], + ], + bind: { + hidden: '{!q35}', + disabled: '{!q35}', + }, + }, + { + xtype: 'proxmoxKVComboBox', + name: 'viommu', + fieldLabel: gettext('vIOMMU'), + reference: 'viommu-i440fx', + deleteEmpty: false, + value: '__default__', + comboItems: [ + ['__default__', Proxmox.Utils.defaultText + ' (None)'], + ['virtio', 'VirtIO'], + ], + bind: { + hidden: '{q35}', + disabled: '{q35}', + }, + }, ], }); -- 2.39.2