From: Markus Frank <m.frank@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v4 5/5] ui: MachineEdit with viommu checkbox
Date: Fri, 25 Nov 2022 15:08:57 +0100 [thread overview]
Message-ID: <20221125140857.121622-6-m.frank@proxmox.com> (raw)
In-Reply-To: <20221125140857.121622-1-m.frank@proxmox.com>
Added a Checkbox to enable viommu, if q35 is selected.
Otherwise (i440fx & !kvm) the checkbox is disabled, if not ticked on
before. If ticked on before, the user is able to uncheck the checkbox.
If kvm is deactivated or i440fx is selected, a Hint tells that q35 and
kvm are required for vIOMMU.
The UI also needs to parse the new machine parameter as PropertyString.
Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
www/manager6/qemu/MachineEdit.js | 56 ++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/www/manager6/qemu/MachineEdit.js b/www/manager6/qemu/MachineEdit.js
index f928c80c..03fcf36d 100644
--- a/www/manager6/qemu/MachineEdit.js
+++ b/www/manager6/qemu/MachineEdit.js
@@ -1,6 +1,7 @@
Ext.define('PVE.qemu.MachineInputPanel', {
extend: 'Proxmox.panel.InputPanel',
xtype: 'pveMachineInputPanel',
+ onlineHelp: 'qm_pci_viommu',
controller: {
xclass: 'Ext.app.ViewController',
@@ -12,11 +13,26 @@ Ext.define('PVE.qemu.MachineInputPanel', {
onMachineChange: function(field, value) {
let me = this;
let version = me.lookup('version');
+ let kvm = me.lookup('kvm');
+ let viommu = me.lookup('viommu');
+ let kvmHint = me.lookup('kvmQ35Hint');
let store = version.getStore();
let oldRec = store.findRecord('id', version.getValue(), 0, false, false, true);
let type = value === 'q35' ? 'q35' : 'i440fx';
store.clearFilter();
store.addFilter(val => val.data.id === 'latest' || val.data.type === type);
+ if ((type === 'q35' && kvm.getValue()) || viommu.getValue()) {
+ viommu.setDisabled(false);
+ kvmHint.setVisible(false);
+ } else {
+ // disable checkbox if vIOMMU is not possible and checkbox was not
+ // ticked on before
+ viommu.setDisabled(true);
+ }
+ if (type === 'i440fx' || !kvm.getValue()) {
+ // show hint when vIOMMU cannot be used
+ kvmHint.setVisible(true);
+ }
if (!me.getView().isWindows) {
version.setValue('latest');
} else {
@@ -35,17 +51,31 @@ Ext.define('PVE.qemu.MachineInputPanel', {
},
onGetValues: function(values) {
+ console.log(values);
if (values.version && values.version !== 'latest') {
values.machine = values.version;
delete values.delete;
+ } else if ((typeof values.machine === 'undefined') && values.viommu) {
+ // set machine to pc to raise the viommu + i440fx error from backend
+ // instead of regex error
+ values.machine = "pc";
+ delete values.delete;
}
delete values.version;
+ if (values.viommu) {
+ values.machine += ",viommu=1";
+ }
+ 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 +88,11 @@ Ext.define('PVE.qemu.MachineInputPanel', {
values.version = 'pc-q35-5.1';
}
}
+
+ me.lookup('kvm').setValue(values.kvm);
+ values.viommu = machineConf.viommu === "1";
+ 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 +148,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,
+ },
+ {
+ xtype: 'displayfield',
+ name: 'kvmQ35Hint',
+ reference: 'kvmQ35Hint',
+ userCls: 'pmx-hint',
+ value: gettext('vIOMMU needs kvm enabled and q35 firmware'),
+ hidden: true,
+ },
],
});
@@ -137,6 +192,7 @@ Ext.define('PVE.qemu.MachineEdit', {
let conf = response.result.data;
let values = {
machine: conf.machine || '__default__',
+ kvm: conf.kvm,
};
values.isWindows = PVE.Utils.is_windows(conf.ostype);
me.setValues(values);
--
2.30.2
next prev parent reply other threads:[~2022-11-25 14:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 14:08 [pve-devel] [PATCH qemu-server v4 0/5] vIOMMU-Feature Markus Frank
2022-11-25 14:08 ` [pve-devel] [PATCH qemu-server v4 1/5] tests: replaced somemachine&someothermachine with q35&pc Markus Frank
2022-11-25 14:08 ` [pve-devel] [PATCH qemu-server v4 2/5] fix #3784: Parameter for guest vIOMMU & machine as property-string Markus Frank
2023-01-13 9:51 ` Wolfgang Bumiller
2022-11-25 14:08 ` [pve-devel] [PATCH qemu-server v4 3/5] added test-cases for new machine-syntax & viommu Markus Frank
2022-11-25 14:08 ` [pve-devel] [PATCH docs v4 4/5] added vIOMMU documentation Markus Frank
2023-01-13 10:09 ` Wolfgang Bumiller
2023-01-13 13:31 ` Markus Frank
2023-01-16 10:00 ` Wolfgang Bumiller
2023-01-17 10:55 ` Markus Frank
2023-01-17 15:01 ` Wolfgang Bumiller
2022-11-25 14:08 ` Markus Frank [this message]
2023-01-12 13:51 ` [pve-devel] [PATCH qemu-server v4 0/5] vIOMMU-Feature Markus Frank
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=20221125140857.121622-6-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