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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 13EBBD1D0 for ; Thu, 17 Aug 2023 15:59:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F181430E51 for ; Thu, 17 Aug 2023 15:59:41 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 17 Aug 2023 15:59:41 +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 177A5419CB for ; Thu, 17 Aug 2023 15:59:41 +0200 (CEST) Message-ID: <0eecbb04-41a3-ed35-e263-fc85386cee10@proxmox.com> Date: Thu, 17 Aug 2023 15:59:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Content-Language: en-US To: Proxmox VE development discussion , Markus Frank References: <20230118135800.131382-1-m.frank@proxmox.com> <20230118135800.131382-6-m.frank@proxmox.com> From: Fiona Ebner In-Reply-To: <20230118135800.131382-6-m.frank@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 1.522 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 NICE_REPLY_A -3.165 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH manager v5 5/5] ui: MachineEdit with viommu checkbox 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: Thu, 17 Aug 2023 13:59:42 -0000 Am 18.01.23 um 14:58 schrieb Markus Frank: > @@ -38,14 +54,27 @@ Ext.define('PVE.qemu.MachineInputPanel', { > if (values.version && values.version !== 'latest') { > values.machine = values.version; > delete values.delete; > + } else if (values.machine === undefined && values.viommu) { > + // set machine to pc to raise the viommu + i440fx error > + // from qemu-server instead of a regex error > + values.machine = "pc"; > + delete values.delete; > } > delete values.version; > + if (values.viommu) { > + values.machine += ",viommu=1"; > + } Nit: could use PVE.Parser.printPropertyString but no big deal > + delete values.viommu; > + delete values.kvm; > return values; > }, > > 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 +87,11 @@ Ext.define('PVE.qemu.MachineInputPanel', { > values.version = 'pc-q35-5.1'; > } > } > + > + me.lookup('kvm').setValue(values.kvm); > + values.viommu = machineConf.viommu === '1'; Should be PVE.Parser.parseBoolean to cover all cases (i.e. also 'on', 'yes' and 'true' can be in the config) > + me.lookup('viommu').setValue(values.viommu); > + > if (values.machine !== '__default__' && values.machine !== 'q35') { > values.version = values.machine; > values.machine = values.version.match(/q35/) ? 'q35' : '__default__'; > @@ -113,6 +147,26 @@ Ext.define('PVE.qemu.MachineInputPanel', { > fieldLabel: gettext('Note'), > value: gettext('Machine version change may affect hardware layout and settings in the guest OS.'), > }, > + { > + xtype: 'proxmoxcheckbox', > + fieldLabel: gettext('vIOMMU'), > + name: 'viommu', > + reference: 'viommu', > + }, > + { > + xtype: 'proxmoxcheckbox', > + name: 'kvm', > + reference: 'kvm', > + hidden: true, > + }, Why handle 'kvm' as an UI element? I guess a view model property would be the natural place for this. > + { > + xtype: 'displayfield', > + name: 'kvmQ35Hint', > + reference: 'kvmQ35Hint', > + userCls: 'pmx-hint', > + value: gettext('vIOMMU needs kvm enabled and q35 firmware'), s/firmware/machine type/ > + hidden: true, > + }, > ], > }); > > @@ -135,8 +189,12 @@ Ext.define('PVE.qemu.MachineEdit', { > me.load({ > success: function(response) { > let conf = response.result.data; > + if (conf.kvm === undefined || conf.kvm === null) { > + conf.kvm = 1; > + } Style nit: could be one line with conf.kvm ??= 1; > let values = { > machine: conf.machine || '__default__', > + kvm: conf.kvm, > }; > values.isWindows = PVE.Utils.is_windows(conf.ostype); > me.setValues(values);