* [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues
2024-10-16 16:47 [pve-devel] [PATCH kernel/manager 0/5] fix #5430: ocfs2 io_uring read Daniel Kral
@ 2024-10-16 16:47 ` Daniel Kral
2024-10-17 14:48 ` Friedrich Weber
2024-10-22 14:03 ` [pve-devel] applied: " Thomas Lamprecht
2024-10-16 16:47 ` [pve-devel] [PATCH manager 2/5] ui: vm: factor out async I/O type selector Daniel Kral
` (3 subsequent siblings)
4 siblings, 2 replies; 12+ messages in thread
From: Daniel Kral @ 2024-10-16 16:47 UTC (permalink / raw)
To: pve-devel
Reported in the community forum [0].
This fixes an issue with read/write operations done on ocfs2 with
io_uring. This has caused QEMU guests to be unable to determine the file
format at [1] because of an unsuccessful read and therefore could not
boot, which has been resolved with this patch.
This patch is already merged in Jens Axboe's linux-block tree and also
merged in the mainline v6.12 prepatch kernels:
> # git tag --contains c0a9d496e0fece67db777bd48550376cf2960c47
> v6.12-rc1
> v6.12-rc2
> v6.13-rc3
[0] https://forum.proxmox.com/threads/140273/post-702007
[1] https://elixir.bootlin.com/qemu/v9.0.2/source/block.c#L1031
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
...t-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 patches/kernel/0021-io_uring-rw-treat-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch
diff --git a/patches/kernel/0021-io_uring-rw-treat-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch b/patches/kernel/0021-io_uring-rw-treat-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch
new file mode 100644
index 0000000..7187c94
--- /dev/null
+++ b/patches/kernel/0021-io_uring-rw-treat-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch
@@ -0,0 +1,45 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Tue, 10 Sep 2024 08:30:57 -0600
+Subject: [PATCH] io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN
+
+Some file systems, ocfs2 in this case, will return -EOPNOTSUPP for
+an IOCB_NOWAIT read/write attempt. While this can be argued to be
+correct, the usual return value for something that requires blocking
+issue is -EAGAIN.
+
+A refactoring io_uring commit dropped calling kiocb_done() for
+negative return values, which is otherwise where we already do that
+transformation. To ensure we catch it in both spots, check it in
+__io_read() itself as well.
+
+Reported-by: Robert Sander <r.sander@heinlein-support.de>
+Link: https://fosstodon.org/@gurubert@mastodon.gurubert.de/113112431889638440
+Cc: stable@vger.kernel.org
+Fixes: a08d195b586a ("io_uring/rw: split io_read() into a helper")
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+(cherry picked from commit c0a9d496e0fece67db777bd48550376cf2960c47)
+Signed-off-by: Daniel Kral <d.kral@proxmox.com>
+---
+ io_uring/rw.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/io_uring/rw.c b/io_uring/rw.c
+index c3c154790e45..ed7f67097572 100644
+--- a/io_uring/rw.c
++++ b/io_uring/rw.c
+@@ -825,6 +825,14 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
+
+ ret = io_iter_do_read(rw, &s->iter);
+
++ /*
++ * Some file systems like to return -EOPNOTSUPP for an IOCB_NOWAIT
++ * issue, even though they should be returning -EAGAIN. To be safe,
++ * retry from blocking context for either.
++ */
++ if (ret == -EOPNOTSUPP && force_nonblock)
++ ret = -EAGAIN;
++
+ if (ret == -EAGAIN || (req->flags & REQ_F_REISSUE)) {
+ req->flags &= ~REQ_F_REISSUE;
+ /*
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues
2024-10-16 16:47 ` [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues Daniel Kral
@ 2024-10-17 14:48 ` Friedrich Weber
2024-10-22 14:03 ` [pve-devel] applied: " Thomas Lamprecht
1 sibling, 0 replies; 12+ messages in thread
From: Friedrich Weber @ 2024-10-17 14:48 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Kral
On 16/10/2024 18:47, Daniel Kral wrote:
> Reported in the community forum [0].
>
> This fixes an issue with read/write operations done on ocfs2 with
> io_uring. This has caused QEMU guests to be unable to determine the file
> format at [1] because of an unsuccessful read and therefore could not
> boot, which has been resolved with this patch.
As a smoke test, I ran a 6.8.12-2 kernel with this patch applied on my
workstation today (with a couple of VMs using io_uring on LVM/ZFS), and
did not notice anything out of the ordinary. I did not get around to
actually test the issue with ocfs2, though.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [pve-devel] applied: [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues
2024-10-16 16:47 ` [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues Daniel Kral
2024-10-17 14:48 ` Friedrich Weber
@ 2024-10-22 14:03 ` Thomas Lamprecht
1 sibling, 0 replies; 12+ messages in thread
From: Thomas Lamprecht @ 2024-10-22 14:03 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Kral
Am 16/10/2024 um 18:47 schrieb Daniel Kral:
> Reported in the community forum [0].
>
> This fixes an issue with read/write operations done on ocfs2 with
> io_uring. This has caused QEMU guests to be unable to determine the file
> format at [1] because of an unsuccessful read and therefore could not
> boot, which has been resolved with this patch.
>
> This patch is already merged in Jens Axboe's linux-block tree and also
> merged in the mainline v6.12 prepatch kernels:
>
>> # git tag --contains c0a9d496e0fece67db777bd48550376cf2960c47
>> v6.12-rc1
>> v6.12-rc2
>> v6.13-rc3
>
> [0] https://forum.proxmox.com/threads/140273/post-702007
> [1] https://elixir.bootlin.com/qemu/v9.0.2/source/block.c#L1031
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> ...t-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 patches/kernel/0021-io_uring-rw-treat-EOPNOTSUPP-for-IOCB_NOWAIT-like-EA.patch
>
>
applied, thanks!
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [pve-devel] [PATCH manager 2/5] ui: vm: factor out async I/O type selector
2024-10-16 16:47 [pve-devel] [PATCH kernel/manager 0/5] fix #5430: ocfs2 io_uring read Daniel Kral
2024-10-16 16:47 ` [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues Daniel Kral
@ 2024-10-16 16:47 ` Daniel Kral
2024-10-18 7:42 ` Lukas Wagner
2024-10-16 16:47 ` [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Daniel Kral @ 2024-10-16 16:47 UTC (permalink / raw)
To: pve-devel
Factors out the combo box used for the Async I/O combo box selector,
which is used in the Disk Edit modal window in the VM "Hardware" tab and
the "Disks" tab in the Create Wizard, to reuse it in a future commit.
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/form/AsyncIOTypeSelector.js | 10 ++++++++++
www/manager6/qemu/HDEdit.js | 10 ++--------
3 files changed, 13 insertions(+), 8 deletions(-)
create mode 100644 www/manager6/form/AsyncIOTypeSelector.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 2c3a822b..74a61aa8 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -21,6 +21,7 @@ JSSRC= \
form/ACMEAccountSelector.js \
form/ACMEPluginSelector.js \
form/AgentFeatureSelector.js \
+ form/AsyncIOTypeSelector.js \
form/BackupCompressionSelector.js \
form/BackupModeSelector.js \
form/BandwidthSelector.js \
diff --git a/www/manager6/form/AsyncIOTypeSelector.js b/www/manager6/form/AsyncIOTypeSelector.js
new file mode 100644
index 00000000..83fb40b5
--- /dev/null
+++ b/www/manager6/form/AsyncIOTypeSelector.js
@@ -0,0 +1,10 @@
+Ext.define('PVE.form.AsyncIOTypeSelector', {
+ extend: 'Proxmox.form.KVComboBox',
+ alias: ['widget.AsyncIOTypeSelector'],
+ comboItems: [
+ ['__default__', Proxmox.Utils.defaultText + ' (io_uring)'],
+ ['io_uring', 'io_uring'],
+ ['native', 'native'],
+ ['threads', 'threads'],
+ ],
+});
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index b78647ec..37215361 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -306,17 +306,11 @@ Ext.define('PVE.qemu.HDInputPanel', {
name: 'noreplicate',
},
{
- xtype: 'proxmoxKVComboBox',
+ xtype: 'AsyncIOTypeSelector',
name: 'aio',
+ value: '__default__',
fieldLabel: gettext('Async IO'),
allowBlank: false,
- value: '__default__',
- comboItems: [
- ['__default__', Proxmox.Utils.defaultText + ' (io_uring)'],
- ['io_uring', 'io_uring'],
- ['native', 'native'],
- ['threads', 'threads'],
- ],
},
);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [pve-devel] [PATCH manager 2/5] ui: vm: factor out async I/O type selector
2024-10-16 16:47 ` [pve-devel] [PATCH manager 2/5] ui: vm: factor out async I/O type selector Daniel Kral
@ 2024-10-18 7:42 ` Lukas Wagner
0 siblings, 0 replies; 12+ messages in thread
From: Lukas Wagner @ 2024-10-18 7:42 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Kral
Hello, one comment inline.
Skimmed over the code to spot style issues, correctness
was not really checked.
On 2024-10-16 18:47, Daniel Kral wrote:
> Factors out the combo box used for the Async I/O combo box selector,
> which is used in the Disk Edit modal window in the VM "Hardware" tab and
> the "Disks" tab in the Create Wizard, to reuse it in a future commit.
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> www/manager6/Makefile | 1 +
> www/manager6/form/AsyncIOTypeSelector.js | 10 ++++++++++
> www/manager6/qemu/HDEdit.js | 10 ++--------
> 3 files changed, 13 insertions(+), 8 deletions(-)
> create mode 100644 www/manager6/form/AsyncIOTypeSelector.js
>
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 2c3a822b..74a61aa8 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -21,6 +21,7 @@ JSSRC= \
> form/ACMEAccountSelector.js \
> form/ACMEPluginSelector.js \
> form/AgentFeatureSelector.js \
> + form/AsyncIOTypeSelector.js \
> form/BackupCompressionSelector.js \
> form/BackupModeSelector.js \
> form/BandwidthSelector.js \
> diff --git a/www/manager6/form/AsyncIOTypeSelector.js b/www/manager6/form/AsyncIOTypeSelector.js
> new file mode 100644
> index 00000000..83fb40b5
> --- /dev/null
> +++ b/www/manager6/form/AsyncIOTypeSelector.js
> @@ -0,0 +1,10 @@
> +Ext.define('PVE.form.AsyncIOTypeSelector', {
> + extend: 'Proxmox.form.KVComboBox',
> + alias: ['widget.AsyncIOTypeSelector'],
Usually we use a prefix `pve` (for components defined in pve-manager) or `pmx`
(for components defined in proxmox-widget-toolkit`) prefix, so this
should be `widget.pveAsyncIoTypeSelector`
> + comboItems: [
> + ['__default__', Proxmox.Utils.defaultText + ' (io_uring)'],
> + ['io_uring', 'io_uring'],
> + ['native', 'native'],
> + ['threads', 'threads'],
> + ],
> +});
> diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
> index b78647ec..37215361 100644
> --- a/www/manager6/qemu/HDEdit.js
> +++ b/www/manager6/qemu/HDEdit.js
> @@ -306,17 +306,11 @@ Ext.define('PVE.qemu.HDInputPanel', {
> name: 'noreplicate',
> },
> {
> - xtype: 'proxmoxKVComboBox',
> + xtype: 'AsyncIOTypeSelector',
> name: 'aio',
> + value: '__default__',
> fieldLabel: gettext('Async IO'),
> allowBlank: false,
> - value: '__default__',
> - comboItems: [
> - ['__default__', Proxmox.Utils.defaultText + ' (io_uring)'],
> - ['io_uring', 'io_uring'],
> - ['native', 'native'],
> - ['threads', 'threads'],
> - ],
> },
> );
>
--
- Lukas
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options
2024-10-16 16:47 [pve-devel] [PATCH kernel/manager 0/5] fix #5430: ocfs2 io_uring read Daniel Kral
2024-10-16 16:47 ` [pve-devel] [PATCH kernel 1/5] fix #5430: cherry-pick fix for ocfs2 io_uring rw issues Daniel Kral
2024-10-16 16:47 ` [pve-devel] [PATCH manager 2/5] ui: vm: factor out async I/O type selector Daniel Kral
@ 2024-10-16 16:47 ` Daniel Kral
2024-10-18 7:42 ` Lukas Wagner
2024-10-16 16:47 ` [pve-devel] [PATCH manager 4/5] ui: vm: make cloudinit drive editable Daniel Kral
2024-10-16 16:47 ` [pve-devel] [PATCH manager 5/5] fix #5430: ui: vm: allow editing cloudinit aio and cache options Daniel Kral
4 siblings, 1 reply; 12+ messages in thread
From: Daniel Kral @ 2024-10-16 16:47 UTC (permalink / raw)
To: pve-devel
Adds cache and async I/O selectors to the CDROM Drive Edit modal window
in the "Hardware" tab. This allows users to set these options in the
WebGUI when the VM fails to start because the underlying storage
(driver) does not support a specific set of configurations.
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
www/manager6/qemu/CDEdit.js | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 3cc16205..f15905e7 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -7,6 +7,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
onGetValues: function(values) {
var me = this;
+ var params = {};
var confid = me.confid || values.controller + values.deviceid;
me.drive.media = 'cdrom';
@@ -18,7 +19,8 @@ Ext.define('PVE.qemu.CDInputPanel', {
me.drive.file = 'none';
}
- var params = {};
+ PVE.Utils.propertyStringSet(me.drive, values.cache, 'cache');
+ PVE.Utils.propertyStringSet(me.drive, values.aio, 'aio');
params[confid] = PVE.Parser.printQemuDrive(me.drive);
@@ -46,6 +48,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
values.cdimage = drive.file;
}
+ values.cache = drive.cache || '__default__';
+ values.aio = drive.aio || '__default__';
+
me.drive = drive;
me.setValues(values);
@@ -118,6 +123,27 @@ Ext.define('PVE.qemu.CDInputPanel', {
me.items = items;
+ // those are only useful for specific niche use cases
+ if (!me.insideWizard) {
+ me.advancedColumn1 = [
+ {
+ xtype: 'CacheTypeSelector',
+ name: 'cache',
+ value: '__default__',
+ fieldLabel: gettext('Cache'),
+ },
+ ];
+ me.advancedColumn2 = [
+ {
+ xtype: 'AsyncIOTypeSelector',
+ name: 'aio',
+ value: '__default__',
+ fieldLabel: gettext('Async IO'),
+ allowBlank: false,
+ },
+ ];
+ }
+
me.callParent();
},
});
@@ -125,7 +151,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
Ext.define('PVE.qemu.CDEdit', {
extend: 'Proxmox.window.Edit',
- width: 400,
+ width: 550,
initComponent: function() {
var me = this;
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options
2024-10-16 16:47 ` [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
@ 2024-10-18 7:42 ` Lukas Wagner
2024-10-23 11:30 ` Daniel Kral
0 siblings, 1 reply; 12+ messages in thread
From: Lukas Wagner @ 2024-10-18 7:42 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Kral
Some suggestions inline. Skimmed over the code to spot style issues, correctness
was not really checked.
On 2024-10-16 18:47, Daniel Kral wrote:
> Adds cache and async I/O selectors to the CDROM Drive Edit modal window
> in the "Hardware" tab. This allows users to set these options in the
> WebGUI when the VM fails to start because the underlying storage
> (driver) does not support a specific set of configurations.
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> www/manager6/qemu/CDEdit.js | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
> index 3cc16205..f15905e7 100644
> --- a/www/manager6/qemu/CDEdit.js
> +++ b/www/manager6/qemu/CDEdit.js
> @@ -7,6 +7,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
> onGetValues: function(values) {
> var me = this;
>
> + var params = {};
Note: For new code we should use `let` or `const` insted of `var` [1].
When touching existing code can IMO also change it to `let`, but of course
familiarize yourself first with the differences between the three and make sure
that you don't introduce any unwanted changes (e.g. due to changed scoping).
[1]: https://pve.proxmox.com/wiki/Javascript_Style_Guide
> var confid = me.confid || values.controller + values.deviceid;
>
> me.drive.media = 'cdrom';
> @@ -18,7 +19,8 @@ Ext.define('PVE.qemu.CDInputPanel', {
> me.drive.file = 'none';
> }
>
> - var params = {};
> + PVE.Utils.propertyStringSet(me.drive, values.cache, 'cache');
> + PVE.Utils.propertyStringSet(me.drive, values.aio, 'aio');
>
> params[confid] = PVE.Parser.printQemuDrive(me.drive);
>
> @@ -46,6 +48,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
> values.cdimage = drive.file;
> }
>
> + values.cache = drive.cache || '__default__';
> + values.aio = drive.aio || '__default__';
> +
> me.drive = drive;
>
> me.setValues(values);
> @@ -118,6 +123,27 @@ Ext.define('PVE.qemu.CDInputPanel', {
>
> me.items = items;
>
> + // those are only useful for specific niche use cases
> + if (!me.insideWizard) {
> + me.advancedColumn1 = [
> + {
> + xtype: 'CacheTypeSelector',
> + name: 'cache',
> + value: '__default__',
> + fieldLabel: gettext('Cache'),
> + },
> + ];
> + me.advancedColumn2 = [
> + {
> + xtype: 'AsyncIOTypeSelector',
> + name: 'aio',
> + value: '__default__',
> + fieldLabel: gettext('Async IO'),
> + allowBlank: false,
> + },
> + ];
> + }
> +
> me.callParent();
> },
> });
> @@ -125,7 +151,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
> Ext.define('PVE.qemu.CDEdit', {
> extend: 'Proxmox.window.Edit',
>
> - width: 400,
> + width: 550,
This change is not mentioned in the commit message and should probably
be split out into its own commit.
>
> initComponent: function() {
> var me = this;
--
- Lukas
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options
2024-10-18 7:42 ` Lukas Wagner
@ 2024-10-23 11:30 ` Daniel Kral
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Kral @ 2024-10-23 11:30 UTC (permalink / raw)
To: Lukas Wagner, Proxmox VE development discussion
On 10/18/24 09:42, Lukas Wagner wrote:
>> @@ -125,7 +151,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
>> Ext.define('PVE.qemu.CDEdit', {
>> extend: 'Proxmox.window.Edit',
>>
>> - width: 400,
>> + width: 550,
>
> This change is not mentioned in the commit message and should probably
> be split out into its own commit.
I added a small paragraph to the commit message, that makes that change
more transparent and why it is needed in this commit, as the added
options would be a bit messed up by the width limit ;).
Thanks for the style review! I've made the changes (including those in
the other two replies) to the patch series and sent out a v2 [0].
[0]
https://lore.proxmox.com/pve-devel/20241023112246.85637-1-d.kral@proxmox.com/
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [pve-devel] [PATCH manager 4/5] ui: vm: make cloudinit drive editable
2024-10-16 16:47 [pve-devel] [PATCH kernel/manager 0/5] fix #5430: ocfs2 io_uring read Daniel Kral
` (2 preceding siblings ...)
2024-10-16 16:47 ` [pve-devel] [PATCH manager 3/5] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
@ 2024-10-16 16:47 ` Daniel Kral
2024-10-18 7:42 ` Lukas Wagner
2024-10-16 16:47 ` [pve-devel] [PATCH manager 5/5] fix #5430: ui: vm: allow editing cloudinit aio and cache options Daniel Kral
4 siblings, 1 reply; 12+ messages in thread
From: Daniel Kral @ 2024-10-16 16:47 UTC (permalink / raw)
To: pve-devel
Implements the functionality to allow subsequent changes to the
CloudInit drive under the VM "Hardware" tab. This is needed to implement
further changes in a future commit.
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
www/manager6/qemu/CIDriveEdit.js | 100 ++++++++++++++++++++++--------
www/manager6/qemu/HardwareView.js | 4 +-
2 files changed, 77 insertions(+), 27 deletions(-)
diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index a9ca8bf1..0494f9c5 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -4,28 +4,55 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
insideWizard: false,
- vmconfig: {}, // used to select usused disks
+ vmconfig: {}, // used to select unused disks
onGetValues: function(values) {
var me = this;
- var drive = {};
var params = {};
- drive.file = values.hdstorage + ":cloudinit";
- drive.format = values.diskformat;
- params[values.controller + values.deviceid] = PVE.Parser.printQemuDrive(drive);
+ var confid = me.confid || values.controller + values.deviceid;
+
+ // only set these when we create cloudinit files
+ if (me.isCreate) {
+ me.drive.file = values.hdstorage + ":cloudinit";
+ me.drive.format = values.diskformat;
+ }
+
+ params[confid] = PVE.Parser.printQemuDrive(me.drive);
+
return params;
},
setNodename: function(nodename) {
var me = this;
+
me.down('#hdstorage').setNodename(nodename);
me.down('#hdimage').setStorage(undefined, nodename);
},
setVMConfig: function(config) {
var me = this;
- me.down('#drive').setVMConfig(config, 'cdrom');
+
+ let bussel = me.down('#drive');
+ if (bussel) {
+ bussel.setVMConfig(config, 'cdrom');
+ }
+ },
+
+ setDrive: function(drive) {
+ var me = this;
+
+ var values = {};
+
+ var match = drive.file.match(/^([^:]+):/);
+ if (match) {
+ values.hdstorage = match[1];
+ }
+ values.hdimage = drive.file;
+
+ me.drive = drive;
+
+ me.setValues(values);
},
initComponent: function() {
@@ -33,22 +60,30 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
me.drive = {};
- me.items = [
- {
+ let items = [];
+
+ if (me.isCreate) {
+ items.push({
xtype: 'pveControllerSelector',
withVirtIO: false,
itemId: 'drive',
fieldLabel: gettext('CloudInit Drive'),
name: 'drive',
- },
- {
- xtype: 'pveDiskStorageSelector',
- itemId: 'storselector',
- storageContent: 'images',
- nodename: me.nodename,
- hideSize: true,
- },
- ];
+ });
+ }
+
+ items.push({
+ xtype: 'pveDiskStorageSelector',
+ itemId: 'storselector',
+ storageContent: 'images',
+ nodename: me.nodename,
+ disabled: !me.isCreate,
+ hideFormat: !me.isCreate,
+ hideSize: true,
+ });
+
+ me.items = items;
+
me.callParent();
},
});
@@ -57,9 +92,6 @@ Ext.define('PVE.qemu.CIDriveEdit', {
extend: 'Proxmox.window.Edit',
xtype: 'pveCIDriveEdit',
- isCreate: true,
- subject: gettext('CloudInit Drive'),
-
initComponent: function() {
var me = this;
@@ -68,17 +100,35 @@ Ext.define('PVE.qemu.CIDriveEdit', {
throw "no node name specified";
}
- me.items = [{
- xtype: 'pveCIDriveInputPanel',
- itemId: 'cipanel',
+ me.isCreate = !me.confid;
+
+ var ipanel = Ext.create('PVE.qemu.CIDriveInputPanel', {
+ confid: me.confid,
nodename: nodename,
- }];
+ isCreate: me.isCreate,
+ });
+
+ Ext.applyIf(me, {
+ subject: gettext('CloudInit Drive'),
+ items: [ipanel],
+ });
me.callParent();
me.load({
success: function(response, opts) {
- me.down('#cipanel').setVMConfig(response.result.data);
+ ipanel.setVMConfig(response.result.data);
+
+ if (me.confid) {
+ var value = response.result.data[me.confid];
+ var drive = PVE.Parser.parseQemuDrive(me.confid, value);
+ if (!drive) {
+ Ext.Msg.alert('Error', 'Unable to parse drive options');
+ me.close();
+ return;
+ }
+ ipanel.setDrive(drive);
+ }
},
});
},
diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 86d5f4cf..c7a77bd9 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -350,7 +350,7 @@ Ext.define('PVE.qemu.HardwareView', {
if (rowdef.isOnStorageBus) {
let value = me.getObjectValue(rec.data.key, '', true);
if (isCloudInitKey(value)) {
- return;
+ editor = 'PVE.qemu.CIDriveEdit';
} else if (value.match(/media=cdrom/)) {
editor = 'PVE.qemu.CDEdit';
} else if (!diskCap) {
@@ -629,7 +629,7 @@ Ext.define('PVE.qemu.HardwareView', {
remove_btn.RESTMethod = isUnusedDisk || (isDisk && isRunning) ? 'POST' : 'PUT';
edit_btn.setDisabled(
- deleted || !row.editor || isCloudInit || (isCDRom && !cdromCap) || (isDisk && !diskCap));
+ deleted || !row.editor || (isCDRom && !cdromCap) || (isDisk && !diskCap));
diskaction_btn.setDisabled(
pending ||
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [pve-devel] [PATCH manager 4/5] ui: vm: make cloudinit drive editable
2024-10-16 16:47 ` [pve-devel] [PATCH manager 4/5] ui: vm: make cloudinit drive editable Daniel Kral
@ 2024-10-18 7:42 ` Lukas Wagner
0 siblings, 0 replies; 12+ messages in thread
From: Lukas Wagner @ 2024-10-18 7:42 UTC (permalink / raw)
To: Proxmox VE development discussion, Daniel Kral
Some suggestions inline. Skimmed over the code to spot style issues, correctness
was not really checked.
Same remarks regarding `var` vs `let` apply also to this patch.
On 2024-10-16 18:47, Daniel Kral wrote:
> Implements the functionality to allow subsequent changes to the
> CloudInit drive under the VM "Hardware" tab. This is needed to implement
> further changes in a future commit.
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> www/manager6/qemu/CIDriveEdit.js | 100 ++++++++++++++++++++++--------
> www/manager6/qemu/HardwareView.js | 4 +-
> 2 files changed, 77 insertions(+), 27 deletions(-)
>
> diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
> index a9ca8bf1..0494f9c5 100644
> --- a/www/manager6/qemu/CIDriveEdit.js
> +++ b/www/manager6/qemu/CIDriveEdit.js
> @@ -4,28 +4,55 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
>
> insideWizard: false,
>
> - vmconfig: {}, // used to select usused disks
> + vmconfig: {}, // used to select unused disks
Maybe split this typo fix into a separate commit?
>
> onGetValues: function(values) {
> var me = this;
>
> - var drive = {};
> var params = {};
> - drive.file = values.hdstorage + ":cloudinit";
> - drive.format = values.diskformat;
> - params[values.controller + values.deviceid] = PVE.Parser.printQemuDrive(drive);
> + var confid = me.confid || values.controller + values.deviceid;
> +
> + // only set these when we create cloudinit files
> + if (me.isCreate) {
> + me.drive.file = values.hdstorage + ":cloudinit";
> + me.drive.format = values.diskformat;
> + }
> +
> + params[confid] = PVE.Parser.printQemuDrive(me.drive);
> +
> return params;
> },
>
> setNodename: function(nodename) {
> var me = this;
> +
Maybe do this in a separate commit if you
want to do a change like this to e.g. improve readability
> me.down('#hdstorage').setNodename(nodename);
> me.down('#hdimage').setStorage(undefined, nodename);
> },
>
> setVMConfig: function(config) {
> var me = this;
> - me.down('#drive').setVMConfig(config, 'cdrom');
> +
> + let bussel = me.down('#drive');
> + if (bussel) {
> + bussel.setVMConfig(config, 'cdrom');
> + }
> + },
bussel as a in ... bus selector? Maybe rather call it busSelector, has less of a
'huh?'-factor :)
> +
> + setDrive: function(drive) {
> + var me = this;
> +
> + var values = {};
> +
> + var match = drive.file.match(/^([^:]+):/);
> + if (match) {
> + values.hdstorage = match[1];
> + }
> + values.hdimage = drive.file;
> +
> + me.drive = drive;
> +
> + me.setValues(values);
> },
>
> initComponent: function() {
> @@ -33,22 +60,30 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
>
> me.drive = {};
>
> - me.items = [
> - {
> + let items = [];
> +
> + if (me.isCreate) {
> + items.push({
> xtype: 'pveControllerSelector',
> withVirtIO: false,
> itemId: 'drive',
> fieldLabel: gettext('CloudInit Drive'),
> name: 'drive',
> - },
> - {
> - xtype: 'pveDiskStorageSelector',
> - itemId: 'storselector',
> - storageContent: 'images',
> - nodename: me.nodename,
> - hideSize: true,
> - },
> - ];
> + });
> + }
> +
> + items.push({
> + xtype: 'pveDiskStorageSelector',
> + itemId: 'storselector',
> + storageContent: 'images',
> + nodename: me.nodename,
> + disabled: !me.isCreate,
> + hideFormat: !me.isCreate,
> + hideSize: true,
> + });
> +
> + me.items = items;
> +
> me.callParent();
> },
> });
> @@ -57,9 +92,6 @@ Ext.define('PVE.qemu.CIDriveEdit', {
> extend: 'Proxmox.window.Edit',
> xtype: 'pveCIDriveEdit',
>
> - isCreate: true,
> - subject: gettext('CloudInit Drive'),
> -
> initComponent: function() {
> var me = this;
>
> @@ -68,17 +100,35 @@ Ext.define('PVE.qemu.CIDriveEdit', {
> throw "no node name specified";
> }
>
> - me.items = [{
> - xtype: 'pveCIDriveInputPanel',
> - itemId: 'cipanel',
> + me.isCreate = !me.confid;
> +
> + var ipanel = Ext.create('PVE.qemu.CIDriveInputPanel', {
> + confid: me.confid,
> nodename: nodename,
> - }];
> + isCreate: me.isCreate,
> + });
> +
> + Ext.applyIf(me, {
> + subject: gettext('CloudInit Drive'),
> + items: [ipanel],
> + });
>
> me.callParent();
>
> me.load({
> success: function(response, opts) {
> - me.down('#cipanel').setVMConfig(response.result.data);
> + ipanel.setVMConfig(response.result.data);
> +
> + if (me.confid) {
> + var value = response.result.data[me.confid];
> + var drive = PVE.Parser.parseQemuDrive(me.confid, value);
> + if (!drive) {
> + Ext.Msg.alert('Error', 'Unable to parse drive options');
> + me.close();
> + return;
> + }
> + ipanel.setDrive(drive);
> + }
> },
> });
> },
> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
> index 86d5f4cf..c7a77bd9 100644
> --- a/www/manager6/qemu/HardwareView.js
> +++ b/www/manager6/qemu/HardwareView.js
> @@ -350,7 +350,7 @@ Ext.define('PVE.qemu.HardwareView', {
> if (rowdef.isOnStorageBus) {
> let value = me.getObjectValue(rec.data.key, '', true);
> if (isCloudInitKey(value)) {
> - return;
> + editor = 'PVE.qemu.CIDriveEdit';
> } else if (value.match(/media=cdrom/)) {
> editor = 'PVE.qemu.CDEdit';
> } else if (!diskCap) {
> @@ -629,7 +629,7 @@ Ext.define('PVE.qemu.HardwareView', {
> remove_btn.RESTMethod = isUnusedDisk || (isDisk && isRunning) ? 'POST' : 'PUT';
>
> edit_btn.setDisabled(
> - deleted || !row.editor || isCloudInit || (isCDRom && !cdromCap) || (isDisk && !diskCap));
> + deleted || !row.editor || (isCDRom && !cdromCap) || (isDisk && !diskCap));
>
> diskaction_btn.setDisabled(
> pending ||
--
- Lukas
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [pve-devel] [PATCH manager 5/5] fix #5430: ui: vm: allow editing cloudinit aio and cache options
2024-10-16 16:47 [pve-devel] [PATCH kernel/manager 0/5] fix #5430: ocfs2 io_uring read Daniel Kral
` (3 preceding siblings ...)
2024-10-16 16:47 ` [pve-devel] [PATCH manager 4/5] ui: vm: make cloudinit drive editable Daniel Kral
@ 2024-10-16 16:47 ` Daniel Kral
4 siblings, 0 replies; 12+ messages in thread
From: Daniel Kral @ 2024-10-16 16:47 UTC (permalink / raw)
To: pve-devel
Adds cache and async I/O selectors to the CloudInit Drive Edit modal
window in the "Hardware" tab. This allows users to set these options in
the WebGUI when the VM fails to start because the underlying storage
(driver) does not support a specific set of configurations.
Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
www/manager6/qemu/CIDriveEdit.js | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index 0494f9c5..2508cd8e 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -18,6 +18,9 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
me.drive.format = values.diskformat;
}
+ PVE.Utils.propertyStringSet(me.drive, values.cache, 'cache');
+ PVE.Utils.propertyStringSet(me.drive, values.aio, 'aio');
+
params[confid] = PVE.Parser.printQemuDrive(me.drive);
return params;
@@ -50,6 +53,9 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
}
values.hdimage = drive.file;
+ values.cache = drive.cache || '__default__';
+ values.aio = drive.aio || '__default__';
+
me.drive = drive;
me.setValues(values);
@@ -84,6 +90,22 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
me.items = items;
+ me.advancedColumnB = [
+ {
+ xtype: 'CacheTypeSelector',
+ name: 'cache',
+ value: '__default__',
+ fieldLabel: gettext('Cache'),
+ },
+ {
+ xtype: 'AsyncIOTypeSelector',
+ name: 'aio',
+ value: '__default__',
+ fieldLabel: gettext('Async IO'),
+ allowBlank: false,
+ },
+ ];
+
me.callParent();
},
});
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 12+ messages in thread