public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write
@ 2024-10-23 11:22 Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals Daniel Kral
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 UTC (permalink / raw)
  To: pve-devel

Since around Linux kernel version 6.7 [0], and as reported by users
kernel version `6.8.4-2-pve`, a bug was introduced by a refactoring of
the io_read function in the io_uring subsystem. This causes any VM to
fail to start, when io_uring is used for CDROM drives (including
CloudInit drives) and VM disks (even though I could not reproduce the
latter).

The patch series contains the following changes:

1. refactor code for the upcoming changes (#1-#3),
2. allow changes to aio/cache options for CDROMs in the GUI (#4),
3. allow changes to aio/cache options for CloudInit in the GUI (#5-6).

The last two UI changes are an optional part that was discussed off-list
as a solution before I knew about the kernel patch and I would still
propose it as a useful set of changes.

These changes allow users to change the cache and async I/O options for
both CDROM and CloudInit drives. These changes are not necessary for the
whole patch series and can be applied separately, or dropped.

discussion
===

Since the kernel patch has already been applied to pve-kernel, the UI
changes might not be needed anymore, but could very well be an
additional solution (for this or other use cases).

Another discussion to this patch series - as Shannon and Fabian have
mentioned to me off-list - was if there are actual benefits for CDROM
and CloudInit drives to be read with io_uring enabled. If not, we could
remove the io_uring default from CDROMs and CloudInit drives in
config_to_command in qemu-server.

history
===

Differences to v1 (thanks to @Lukas for the style review):
- Remove the applied pve-kernel patch from the series
- Move refactoring in pve-manager to their own separate patches
- Use let instead of var (also in existing code for consistency, as
  no variable was dependent on its scope)
- Rename variables whose names were too unclear
- Change "widget.AsyncIOTypeSelector" to "widget.pveAsyncIoTypeSelector"
- Include a reason why the CDEdit modal width has been changed in the
  commit's message
- Adapt cover letter to refer only to the UI changes

Daniel Kral (6):
  ui: vm: change var to let in CDROM and CloudInit edit modals
  ui: vm: improve code readability of CDROM and CloudInit edit modals
  ui: vm: factor out async I/O type selector
  fix #5430: ui: vm: allow editing cdrom aio and cache options
  ui: vm: make cloudinit drive editable
  fix #5430: ui: vm: allow editing cloudinit aio and cache options

 www/manager6/Makefile                    |   1 +
 www/manager6/form/AsyncIOTypeSelector.js |  10 ++
 www/manager6/qemu/CDEdit.js              |  76 +++++++++----
 www/manager6/qemu/CIDriveEdit.js         | 131 +++++++++++++++++------
 www/manager6/qemu/HDEdit.js              |  10 +-
 www/manager6/qemu/HardwareView.js        |   4 +-
 6 files changed, 169 insertions(+), 63 deletions(-)
 create mode 100644 www/manager6/form/AsyncIOTypeSelector.js

-- 
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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 2/6] ui: vm: improve code readability of " Daniel Kral
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 www/manager6/qemu/CDEdit.js      | 35 +++++++++++++++++---------------
 www/manager6/qemu/CIDriveEdit.js | 20 ++++++++++--------
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 3cc16205..fd8e5233 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -5,9 +5,10 @@ Ext.define('PVE.qemu.CDInputPanel', {
     insideWizard: false,
 
     onGetValues: function(values) {
-	var me = this;
+	let me = this;
 
-	var confid = me.confid || values.controller + values.deviceid;
+	let params = {};
+	let confid = me.confid || values.controller + values.deviceid;
 
 	me.drive.media = 'cdrom';
 	if (values.mediaType === 'iso') {
@@ -18,15 +19,13 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	    me.drive.file = 'none';
 	}
 
-	var params = {};
-
 	params[confid] = PVE.Parser.printQemuDrive(me.drive);
 
 	return params;
     },
 
     setVMConfig: function(vmconfig) {
-	var me = this;
+	let me = this;
 
 	if (me.bussel) {
 	    me.bussel.setVMConfig(vmconfig, 'cdrom');
@@ -34,9 +33,10 @@ Ext.define('PVE.qemu.CDInputPanel', {
     },
 
     setDrive: function(drive) {
-	var me = this;
+	let me = this;
+
+	let values = {};
 
-	var values = {};
 	if (drive.file === 'cdrom') {
 	    values.mediaType = 'cdrom';
 	} else if (drive.file === 'none') {
@@ -52,17 +52,17 @@ Ext.define('PVE.qemu.CDInputPanel', {
     },
 
     setNodename: function(nodename) {
-	var me = this;
+	let me = this;
 
 	me.isosel.setNodename(nodename);
     },
 
     initComponent: function() {
-	var me = this;
+	let me = this;
 
 	me.drive = {};
 
-	var items = [];
+	let items = [];
 
 	if (!me.confid) {
 	    me.bussel = Ext.create('PVE.form.ControllerSelector', {
@@ -82,7 +82,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
 		    if (!me.rendered) {
 			return;
 		    }
-		    var cdImageField = me.down('pveIsoSelector');
+		    let cdImageField = me.down('pveIsoSelector');
 		    cdImageField.setDisabled(!value);
 		    if (value) {
 			cdImageField.validate();
@@ -128,16 +128,16 @@ Ext.define('PVE.qemu.CDEdit', {
     width: 400,
 
     initComponent: function() {
-	var me = this;
+	let me = this;
 
-	var nodename = me.pveSelNode.data.node;
+	let nodename = me.pveSelNode.data.node;
 	if (!nodename) {
 	    throw "no node name specified";
 	}
 
 	me.isCreate = !me.confid;
 
-	var ipanel = Ext.create('PVE.qemu.CDInputPanel', {
+	let ipanel = Ext.create('PVE.qemu.CDInputPanel', {
 	    confid: me.confid,
 	    nodename: nodename,
 	});
@@ -152,14 +152,17 @@ Ext.define('PVE.qemu.CDEdit', {
 	me.load({
 	    success: function(response, options) {
 		ipanel.setVMConfig(response.result.data);
+
 		if (me.confid) {
-		    var value = response.result.data[me.confid];
-		    var drive = PVE.Parser.parseQemuDrive(me.confid, value);
+		    let value = response.result.data[me.confid];
+		    let 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/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index a9ca8bf1..a8f57963 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -7,29 +7,33 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
     vmconfig: {}, // used to select usused disks
 
     onGetValues: function(values) {
-	var me = this;
+	let me = this;
+
+	let drive = {};
+	let params = {};
 
-	var drive = {};
-	var params = {};
 	drive.file = values.hdstorage + ":cloudinit";
 	drive.format = values.diskformat;
 	params[values.controller + values.deviceid] = PVE.Parser.printQemuDrive(drive);
+
 	return params;
     },
 
     setNodename: function(nodename) {
-	var me = this;
+	let me = this;
+
 	me.down('#hdstorage').setNodename(nodename);
 	me.down('#hdimage').setStorage(undefined, nodename);
     },
 
     setVMConfig: function(config) {
-	var me = this;
+	let me = this;
+
 	me.down('#drive').setVMConfig(config, 'cdrom');
     },
 
     initComponent: function() {
-	var me = this;
+	let me = this;
 
 	me.drive = {};
 
@@ -61,9 +65,9 @@ Ext.define('PVE.qemu.CIDriveEdit', {
     subject: gettext('CloudInit Drive'),
 
     initComponent: function() {
-	var me = this;
+	let me = this;
 
-	var nodename = me.pveSelNode.data.node;
+	let nodename = me.pveSelNode.data.node;
 	if (!nodename) {
 	    throw "no node name specified";
 	}
-- 
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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 2/6] ui: vm: improve code readability of CDROM and CloudInit edit modals
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 3/6] ui: vm: factor out async I/O type selector Daniel Kral
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 UTC (permalink / raw)
  To: pve-devel

Improves the readability of the CDROM and CloudInit edit modals by
making them consistent with each other, i.e. having more readable
variable names and storing significant subcomponents in variables.

This does not intend any functional changes in the behavior or
appearance of either component.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 www/manager6/qemu/CDEdit.js      | 14 ++++-----
 www/manager6/qemu/CIDriveEdit.js | 54 ++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index fd8e5233..d26d8631 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -27,8 +27,8 @@ Ext.define('PVE.qemu.CDInputPanel', {
     setVMConfig: function(vmconfig) {
 	let me = this;
 
-	if (me.bussel) {
-	    me.bussel.setVMConfig(vmconfig, 'cdrom');
+	if (me.busSelector) {
+	    me.busSelector.setVMConfig(vmconfig, 'cdrom');
 	}
     },
 
@@ -54,7 +54,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
     setNodename: function(nodename) {
 	let me = this;
 
-	me.isosel.setNodename(nodename);
+	me.isoSelector.setNodename(nodename);
     },
 
     initComponent: function() {
@@ -65,10 +65,10 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	let items = [];
 
 	if (!me.confid) {
-	    me.bussel = Ext.create('PVE.form.ControllerSelector', {
+	    me.busSelector = Ext.create('PVE.form.ControllerSelector', {
 		withVirtIO: false,
 	    });
-	    items.push(me.bussel);
+	    items.push(me.busSelector);
 	}
 
 	items.push({
@@ -94,13 +94,13 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	});
 
 
-	me.isosel = Ext.create('PVE.form.IsoSelector', {
+	me.isoSelector = Ext.create('PVE.form.IsoSelector', {
 	    nodename: me.nodename,
 	    insideWizard: me.insideWizard,
 	    name: 'cdimage',
 	});
 
-	items.push(me.isosel);
+	items.push(me.isoSelector);
 
 	items.push({
 	    xtype: 'radiofield',
diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index a8f57963..006f9565 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -11,10 +11,12 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
 
 	let drive = {};
 	let params = {};
+	let confid = values.controller + values.deviceid;
 
 	drive.file = values.hdstorage + ":cloudinit";
 	drive.format = values.diskformat;
-	params[values.controller + values.deviceid] = PVE.Parser.printQemuDrive(drive);
+
+	params[confid] = PVE.Parser.printQemuDrive(drive);
 
 	return params;
     },
@@ -29,7 +31,7 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
     setVMConfig: function(config) {
 	let me = this;
 
-	me.down('#drive').setVMConfig(config, 'cdrom');
+	me.busSelector.setVMConfig(config, 'cdrom');
     },
 
     initComponent: function() {
@@ -37,22 +39,24 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
 
 	me.drive = {};
 
-	me.items = [
-	    {
-		xtype: 'pveControllerSelector',
-		withVirtIO: false,
-		itemId: 'drive',
-		fieldLabel: gettext('CloudInit Drive'),
-		name: 'drive',
-	    },
-	    {
-		xtype: 'pveDiskStorageSelector',
-		itemId: 'storselector',
-		storageContent: 'images',
-		nodename: me.nodename,
-		hideSize: true,
-	    },
-	];
+	let items = [];
+
+	me.busSelector = Ext.create('PVE.form.ControllerSelector', {
+	    withVirtIO: false,
+	    fieldLabel: gettext('CloudInit Drive'),
+	});
+
+	items.push(me.busSelector);
+	items.push({
+	    xtype: 'pveDiskStorageSelector',
+	    itemId: 'storselector',
+	    storageContent: 'images',
+	    nodename: me.nodename,
+	    hideSize: true,
+	});
+
+	me.items = items;
+
 	me.callParent();
     },
 });
@@ -62,7 +66,6 @@ Ext.define('PVE.qemu.CIDriveEdit', {
     xtype: 'pveCIDriveEdit',
 
     isCreate: true,
-    subject: gettext('CloudInit Drive'),
 
     initComponent: function() {
 	let me = this;
@@ -72,17 +75,20 @@ Ext.define('PVE.qemu.CIDriveEdit', {
 	    throw "no node name specified";
 	}
 
-	me.items = [{
-	    xtype: 'pveCIDriveInputPanel',
-	    itemId: 'cipanel',
+	let ipanel = Ext.create('PVE.qemu.CIDriveInputPanel', {
 	    nodename: nodename,
-	}];
+	});
+
+	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);
 	    },
 	});
     },
-- 
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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 3/6] ui: vm: factor out async I/O type selector
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 2/6] ui: vm: improve code readability of " Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 4/6] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 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..f36b0eb3
--- /dev/null
+++ b/www/manager6/form/AsyncIOTypeSelector.js
@@ -0,0 +1,10 @@
+Ext.define('PVE.form.AsyncIOTypeSelector', {
+    extend: 'Proxmox.form.KVComboBox',
+    alias: ['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'],
-		],
 	    },
 	);
 
-- 
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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 4/6] fix #5430: ui: vm: allow editing cdrom aio and cache options
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
                   ` (2 preceding siblings ...)
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 3/6] ui: vm: factor out async I/O type selector Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 5/6] ui: vm: make cloudinit drive editable Daniel Kral
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 UTC (permalink / raw)
  To: pve-devel

Adds cache and async I/O selectors to the CDROM Drive Edit modal 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.

To accommodate the new fields in the modal, the total width is increased
here, so that the fields' content is visible.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 www/manager6/qemu/CDEdit.js | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index d26d8631..3ed33a7c 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -19,6 +19,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	    me.drive.file = 'none';
 	}
 
+	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;
@@ -46,6 +49,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 +124,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 +152,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
 Ext.define('PVE.qemu.CDEdit', {
     extend: 'Proxmox.window.Edit',
 
-    width: 400,
+    width: 550,
 
     initComponent: function() {
 	let 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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 5/6] ui: vm: make cloudinit drive editable
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
                   ` (3 preceding siblings ...)
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 4/6] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 6/6] fix #5430: ui: vm: allow editing cloudinit aio and cache options Daniel Kral
  2024-10-23 12:40 ` [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 UTC (permalink / raw)
  To: pve-devel

Implements the functionality to allow changes to the CloudInit drive
under the VM "Hardware" tab after it has already been created by the
user.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 www/manager6/qemu/CIDriveEdit.js  | 63 +++++++++++++++++++++++++------
 www/manager6/qemu/HardwareView.js |  4 +-
 2 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/www/manager6/qemu/CIDriveEdit.js b/www/manager6/qemu/CIDriveEdit.js
index 006f9565..d12124e8 100644
--- a/www/manager6/qemu/CIDriveEdit.js
+++ b/www/manager6/qemu/CIDriveEdit.js
@@ -9,14 +9,16 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
     onGetValues: function(values) {
 	let me = this;
 
-	let drive = {};
 	let params = {};
-	let confid = values.controller + values.deviceid;
+	let confid = me.confid || values.controller + values.deviceid;
 
-	drive.file = values.hdstorage + ":cloudinit";
-	drive.format = values.diskformat;
+	// 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(drive);
+	params[confid] = PVE.Parser.printQemuDrive(me.drive);
 
 	return params;
     },
@@ -31,7 +33,25 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
     setVMConfig: function(config) {
 	let me = this;
 
-	me.busSelector.setVMConfig(config, 'cdrom');
+	if (me.busSelector) {
+	    me.busSelector.setVMConfig(config, 'cdrom');
+	}
+    },
+
+    setDrive: function(drive) {
+	let me = this;
+
+	let values = {};
+
+	let match = drive.file.match(/^([^:]+):/);
+	if (match) {
+	    values.hdstorage = match[1];
+	}
+	values.hdimage = drive.file;
+
+	me.drive = drive;
+
+	me.setValues(values);
     },
 
     initComponent: function() {
@@ -41,10 +61,12 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
 
 	let items = [];
 
-	me.busSelector = Ext.create('PVE.form.ControllerSelector', {
-	    withVirtIO: false,
-	    fieldLabel: gettext('CloudInit Drive'),
-	});
+	if (me.isCreate) {
+	    me.busSelector = Ext.create('PVE.form.ControllerSelector', {
+		withVirtIO: false,
+		fieldLabel: gettext('CloudInit Drive'),
+	    });
+	}
 
 	items.push(me.busSelector);
 	items.push({
@@ -52,6 +74,8 @@ Ext.define('PVE.qemu.CIDriveInputPanel', {
 	    itemId: 'storselector',
 	    storageContent: 'images',
 	    nodename: me.nodename,
+	    disabled: !me.isCreate,
+	    hideFormat: !me.isCreate,
 	    hideSize: true,
 	});
 
@@ -65,8 +89,6 @@ Ext.define('PVE.qemu.CIDriveEdit', {
     extend: 'Proxmox.window.Edit',
     xtype: 'pveCIDriveEdit',
 
-    isCreate: true,
-
     initComponent: function() {
 	let me = this;
 
@@ -75,8 +97,12 @@ Ext.define('PVE.qemu.CIDriveEdit', {
 	    throw "no node name specified";
 	}
 
+	me.isCreate = !me.confid;
+
 	let ipanel = Ext.create('PVE.qemu.CIDriveInputPanel', {
+	    confid: me.confid,
 	    nodename: nodename,
+	    isCreate: me.isCreate,
 	});
 
 	Ext.applyIf(me, {
@@ -89,6 +115,19 @@ Ext.define('PVE.qemu.CIDriveEdit', {
 	me.load({
 	    success: function(response, opts) {
 		ipanel.setVMConfig(response.result.data);
+
+		if (me.confid) {
+		    let value = response.result.data[me.confid];
+		    let 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] 8+ messages in thread

* [pve-devel] [PATCH manager v2 6/6] fix #5430: ui: vm: allow editing cloudinit aio and cache options
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
                   ` (4 preceding siblings ...)
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 5/6] ui: vm: make cloudinit drive editable Daniel Kral
@ 2024-10-23 11:22 ` Daniel Kral
  2024-10-23 12:40 ` [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 11:22 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 d12124e8..39844146 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;
@@ -49,6 +52,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);
@@ -81,6 +87,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] 8+ messages in thread

* Re: [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write
  2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
                   ` (5 preceding siblings ...)
  2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 6/6] fix #5430: ui: vm: allow editing cloudinit aio and cache options Daniel Kral
@ 2024-10-23 12:40 ` Daniel Kral
  6 siblings, 0 replies; 8+ messages in thread
From: Daniel Kral @ 2024-10-23 12:40 UTC (permalink / raw)
  To: pve-devel

On 10/23/24 13:22, Daniel Kral wrote:
> - Change "widget.AsyncIOTypeSelector" to "widget.pveAsyncIoTypeSelector"

Unfortunately missed to change the usages of the component accordingly 
(in patch #3, #4 and #6) when sending the patches, therefore sent a v3 [0].

[0] 
https://lore.proxmox.com/pve-devel/20241023123722.124478-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] 8+ messages in thread

end of thread, other threads:[~2024-10-23 12:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-23 11:22 [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 1/6] ui: vm: change var to let in CDROM and CloudInit edit modals Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 2/6] ui: vm: improve code readability of " Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 3/6] ui: vm: factor out async I/O type selector Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 4/6] fix #5430: ui: vm: allow editing cdrom aio and cache options Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 5/6] ui: vm: make cloudinit drive editable Daniel Kral
2024-10-23 11:22 ` [pve-devel] [PATCH manager v2 6/6] fix #5430: ui: vm: allow editing cloudinit aio and cache options Daniel Kral
2024-10-23 12:40 ` [pve-devel] [PATCH manager v2 0/6] fix #5430: ocfs2 io_uring read write Daniel Kral

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