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 v10 1/2] ui: machine: add viommu ComboBox
Date: Mon, 15 Apr 2024 10:50:01 +0200	[thread overview]
Message-ID: <20240415085002.665246-1-m.frank@proxmox.com> (raw)

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 <m.frank@proxmox.com>
---
 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





             reply	other threads:[~2024-04-15  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  8:50 Markus Frank [this message]
2024-04-15  8:50 ` [pve-devel] [PATCH manager v10 2/2] ui: machine: add link to documentation of the system settings Markus Frank
2024-04-22 13:13   ` Fiona Ebner
2024-04-22 13:18     ` Dominik Csapak
2024-04-22 13:19       ` Fiona Ebner
2024-04-22 13:21       ` Thomas Lamprecht
2024-04-22 13:22         ` Dominik Csapak
2024-04-22 13:11 ` [pve-devel] [PATCH manager v10 1/2] ui: machine: add viommu ComboBox Fiona Ebner
2024-04-22 13:16   ` Dominik Csapak
2024-04-22 13:24     ` Fiona Ebner
2024-04-22 17:58       ` Thomas Lamprecht
2024-04-22 13:11 ` [pve-devel] applied: " 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=20240415085002.665246-1-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