public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Markus Frank <m.frank@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: MachineEdit with viommu checkbox
Date: Tue,  3 May 2022 13:19:01 +0200	[thread overview]
Message-ID: <20220503111901.126976-4-m.frank@proxmox.com> (raw)
In-Reply-To: <20220503111901.126976-1-m.frank@proxmox.com>

Added a Checkbox to enable viommu, if q35 is selected.
Otherwise (i440fx) the checkbox is disabled.

The GUI also needs to parse the new machine parameter as PropertyString.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 www/manager6/qemu/MachineEdit.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index f928c80c..41c4dd93 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -17,6 +17,13 @@ Ext.define('PVE.qemu.MachineInputPanel', {
 	    let type = value === 'q35' ? 'q35' : 'i440fx';
 	    store.clearFilter();
 	    store.addFilter(val => val.data.id === 'latest' || val.data.type === type);
+	    let viommuButton = me.lookup('viommu');
+	    if (type === 'i440fx') {
+		viommuButton.setValue(false);
+		viommuButton.setDisabled(true);
+	    } else {
+		viommuButton.setDisabled(false);
+	    }
 	    if (!me.getView().isWindows) {
 		version.setValue('latest');
 	    } else {
@@ -40,12 +47,17 @@ Ext.define('PVE.qemu.MachineInputPanel', {
 	    delete values.delete;
 	}
 	delete values.version;
+	if (values.viommu) values.machine += ",viommu=1";
+	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 +66,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 +124,12 @@ Ext.define('PVE.qemu.MachineInputPanel', {
 		},
 	    },
 	},
+	{
+	    xtype: 'proxmoxcheckbox',
+	    fieldLabel: gettext('vIOMMU'),
+	    name: 'viommu',
+	    reference: 'viommu',
+	},
 	{
 	    xtype: 'displayfield',
 	    fieldLabel: gettext('Note'),
-- 
2.30.2





  parent reply	other threads:[~2022-05-03 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 11:18 [pve-devel] [PATCH qemu-server 1/3] tests: replaced somemachine&someothermachine with q35&pc Markus Frank
2022-05-03 11:18 ` [pve-devel] [PATCH qemu-server] fix #3784: Parameter for guest vIOMMU & machine as property-string Markus Frank
2022-07-20 11:28   ` Markus Frank
2022-05-03 11:19 ` [pve-devel] [PATCH qemu-server] added test-cases for new machine-syntax & viommu Markus Frank
2022-05-03 11:19 ` Markus Frank [this message]
2022-05-04  7:57 ` [pve-devel] [PATCH qemu-server 1/3] tests: replaced somemachine&someothermachine with q35&pc Markus Frank
2022-05-05 11:08 ` Daniel Tschlatscher
2022-09-21  9:07 [pve-devel] [PATCH qemu-server 0/3] vIOMMU-Feature Markus Frank
2022-09-21  9:07 ` [pve-devel] [PATCH manager] ui: MachineEdit with viommu checkbox Markus Frank
2022-10-24 14:22   ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220503111901.126976-4-m.frank@proxmox.com \
    --to=m.frank@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal