From: "Max R. Carrara" <m.carrara@proxmox.com>
To: "Elias Huhsovitz" <e.huhsovitz@proxmox.com>,
<pve-devel@lists.proxmox.com>
Subject: Re: [PATCH manager v2] fix #6855: ui: storage: add mount options field for nfs amd smb/cifs
Date: Fri, 24 Jul 2026 11:19:09 +0200 [thread overview]
Message-ID: <DK6OU6EJCMXY.1WUVO53HQBABF@proxmox.com> (raw)
In-Reply-To: <20260723150316.168440-1-e.huhsovitz@proxmox.com>
On Thu Jul 23, 2026 at 5:03 PM CEST, Elias Huhsovitz wrote:
> Add a text field for custom mount options to the NFS and CIFS
> storage configuration dialogs. This allows users to configure
> advanced mount parameters (like 'nconnect', 'rdma', or 'seal')
> directly via the web interface, without needing to use the CLI
> or manually edit storage.cfg.
>
> When nfs version or mount option is being changed:
> Display a hint to the user that changes will require
> remounting the storage to take effect.
>
> Reduce the usage of legacy JS practices, such as 'var' & "+ string
> concatination" in affected functions.
>
> Signed-off-by: Elias Huhsovitz <e.huhsovitz@proxmox.com>
> ---
>
> v1: https://lore.proxmox.com/pve-devel/20260721121334.115027-1-e.huhsovitz@proxmox.com/
>
> This v2 patch addresses comments made in [1].
Thanks for the refresh! Comments inline -- everything works great!
>
> changes v1->v2:
> - add dynamic UI hint when user changes mount config or nfs version
> to inform them them that a remount is required for changes
> to take effect.
Tested this and works as advertised -- the hint is not intrusive at all
and matches the style of the existing SaVC hint.
> - update emptyText placeholders to align with existing PVE UI
> conventions
Also looks neat.
>
> comments that have not been implemented:
> - reboot after passsing invalid option:
> Regarding the concern about correcting an invalid option
> (e.g., port=42069) and the storage failing to reconnect:
> I attempted to reproduce this behavior in my test environment but was unable
> to do so.
> In my testing, correcting the option and saving successfully updated the
> configuration, and the storage reconnected after a few seconds.
>
> If this auto-reconnection behavior is indeed a reproducible edge case in
> specific scenarios, I believe it would be best addressed in a separate,
> dedicated patch.
>
> - automatic re-mount:
> I made the deliberate decision not to implement automatic re-mounting upon
> configuration changes in this patch. Automatically triggering a remount could
> introduce unnecessary complexity and risk disrupting active I/O operations
> (reads/writes) if a user modifies options while the storage is currently in
> use by running guests or backup jobs.
>
> [1] https://lore.proxmox.com/pve-devel/DK4A5D7GDH1S.1WY2YTP8AF8MG@proxmox.com/
Thanks for checking all of this out in-depth. Most of the things I
mentioned were mostly suggestions -- I think the solution with the hint
is indeed the best, especially now that I've seen it. It doesn't break
anything and tells the user transparently what's necessary for the new
mount options to take effect.
Regarding the auto-reconnection issue I had encountered: This was
probably just a fluke / misconception on my part, as I now noticed that
the storage status icons remain with a "?" if I reboot with invalid
mount options specified. When correcting the mount options, the storage
does indeed reconnect correctly after a few seconds.
Though, in my case, the "?" icons in the UI remain, so that's most
likely a different issue. Restarting `pveproxy` makes the correct icons
pop up in the UI again, so that issue seems to be orthogonal to this
patch.
In any case, the patch works as advertised -- the thing with the
duplicate options can be implemented if users actually run into it,
which I think is very unlikely. (And also, it's trivial to implement
anyway.)
Great work! :D
Consider:
Reviewed-by: Max R. Carrara <m.carrara@proxmox.com>
Tested-by: Max R. Carrara <m.carrara@proxmox.com>
>
> www/manager6/storage/CIFSEdit.js | 70 +++++++++++++++++--
> www/manager6/storage/NFSEdit.js | 111 +++++++++++++++++++++++++------
> 2 files changed, 154 insertions(+), 27 deletions(-)
>
> diff --git a/www/manager6/storage/CIFSEdit.js b/www/manager6/storage/CIFSEdit.js
> index 5fe3fefe..313bc7ff 100644
> --- a/www/manager6/storage/CIFSEdit.js
> +++ b/www/manager6/storage/CIFSEdit.js
> @@ -121,7 +121,7 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> onlineHelp: 'storage_cifs',
>
> onGetValues: function (values) {
> - let me = this;
> + const me = this;
>
> if (values.password?.length === 0) {
> delete values.password;
> @@ -133,11 +133,39 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> delete values.subdir;
> }
>
> + if (values.options) {
> + values.options = values.options
> + .split(',')
> + .map((opt) => opt.trim())
> + .filter((opt, index, self) => opt !== '' && self.indexOf(opt) === index)
> + .join(',');
> + }
> +
> + if (!values.options) {
> + delete values.options;
> + if (!me.isCreate) {
> + values.delete = values.delete ? `${values.delete},options` : 'options';
> + }
> + }
> +
> return me.callParent([values]);
> },
>
> + setValues: function (values) {
> + const me = this;
> +
> + me.originalOptions = values.options || '';
> +
> + me.callParent([values]);
> +
> + const hint = me.down('#mountOptionsHint');
> + if (hint) {
> + hint.setHidden(true);
> + }
> + },
> +
> initComponent: function () {
> - var me = this;
> + const me = this;
>
> me.column1 = [
> {
> @@ -149,7 +177,7 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> listeners: {
> change: function (f, value) {
> if (me.isCreate) {
> - let exportField = me.down('field[name=share]');
> + const exportField = me.down('field[name=share]');
> exportField.setServer(value);
> }
> },
> @@ -166,7 +194,7 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> if (!me.isCreate) {
> return;
> }
> - var exportField = me.down('field[name=share]');
> + const exportField = me.down('field[name=share]');
> exportField.setUsername(value);
> },
> },
> @@ -181,7 +209,7 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> minLength: 1,
> listeners: {
> change: function (f, value) {
> - let exportField = me.down('field[name=share]');
> + const exportField = me.down('field[name=share]');
> exportField.setPassword(value);
> },
> },
> @@ -213,7 +241,7 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> listeners: {
> change: function (f, value) {
> if (me.isCreate) {
> - let exportField = me.down('field[name=share]');
> + const exportField = me.down('field[name=share]');
> exportField.setDomain(value);
> }
> },
> @@ -229,6 +257,36 @@ Ext.define('PVE.storage.CIFSInputPanel', {
> },
> ];
>
> + me.advancedColumn2 = [
> + {
> + xtype: 'textfield',
> + name: 'options',
> + fieldLabel: gettext('Mount Options'),
> + emptyText: `${gettext('Example')}: rdma, seal`,
> + allowBlank: true,
> + deleteEmpty: !me.isCreate,
> + listeners: {
> + change: function (field, newValue) {
> + const hint = me.down('#mountOptionsHint');
> + if (hint) {
> + hint.setHidden((newValue || '') === me.originalOptions);
> + }
> + },
> + },
> + },
> + ];
> +
> + me.advancedColumnB = me.advancedColumnB || [];
> + me.advancedColumnB.unshift({
> + xtype: 'displayfield',
> + itemId: 'mountOptionsHint',
> + userCls: 'pmx-hint',
> + hidden: true,
> + value: gettext(
> + 'Changes to mount options require remounting the storage to take effect.',
> + ),
> + });
> +
> me.callParent();
> },
> });
> diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
> index 72db156f..c4756fe8 100644
> --- a/www/manager6/storage/NFSEdit.js
> +++ b/www/manager6/storage/NFSEdit.js
> @@ -57,7 +57,6 @@ Ext.define('PVE.storage.NFSScan', {
> me.callParent();
> },
> });
> -
> Ext.define('PVE.storage.NFSInputPanel', {
> extend: 'PVE.panel.StorageBase',
>
> @@ -66,25 +65,31 @@ Ext.define('PVE.storage.NFSInputPanel', {
> options: [],
>
> onGetValues: function (values) {
> - var me = this;
> -
> - var i;
> - var res = [];
> - for (i = 0; i < me.options.length; i++) {
> - let item = me.options[i];
> - if (!item.match(/^vers=(.*)$/)) {
> - res.push(item);
> - }
> + const me = this;
> + const res = [];
> +
> + if (values.options && values.options.trim() !== '') {
> + const opts = values.options.split(',');
> + opts.forEach((opt) => {
> + const cleanOpt = opt.trim();
> + if (cleanOpt !== '' && !cleanOpt.match(/^vers=(.*)$/) && !res.includes(cleanOpt)) {
> + res.push(cleanOpt);
> + }
> + });
> }
> +
> if (values.nfsversion && values.nfsversion !== '__default__') {
> - res.push('vers=' + values.nfsversion);
> + res.push(`vers=${values.nfsversion}`);
> }
> +
> delete values.nfsversion;
> - values.options = res.join(',');
> - if (values.options === '') {
> +
> + if (res.length > 0) {
> + values.options = res.join(',');
> + } else {
> delete values.options;
> if (!me.isCreate) {
> - values.delete = 'options';
> + values.delete = values.delete ? `${values.delete},options` : 'options';
> }
> }
>
> @@ -92,21 +97,42 @@ Ext.define('PVE.storage.NFSInputPanel', {
> },
>
> setValues: function (values) {
> - var me = this;
> + const me = this;
> +
> if (values.options) {
> - me.options = values.options.split(',');
> - me.options.forEach(function (item) {
> - var match = item.match(/^vers=(.*)$/);
> + const opts = values.options.split(',').map((item) => item.trim());
> +
> + opts.forEach((item) => {
> + const match = item.match(/^vers=(.*)$/);
> if (match) {
> values.nfsversion = match[1];
> }
> });
> +
> + // Filter out "vers=..." and empty strings
> + const otherOptions = opts.filter(
> + (item, index, self) => item !== '' && !item.match(/^vers=(.*)$/),
> + );
> + values.options = otherOptions.join(',');
> +
> + if (values.options === '') {
> + delete values.options;
> + }
> + }
> +
> + me.originalOptions = values.options || '';
> + me.originalNfsVersion = values.nfsversion || '__default__';
> +
> + me.callParent([values]);
> +
> + const hint = me.down('#mountOptionsHint');
> + if (hint) {
> + hint.setHidden(true);
> }
> - return me.callParent([values]);
> },
>
> initComponent: function () {
> - var me = this;
> + const me = this;
>
> me.column1 = [
> {
> @@ -118,7 +144,7 @@ Ext.define('PVE.storage.NFSInputPanel', {
> listeners: {
> change: function (f, value) {
> if (me.isCreate) {
> - let exportField = me.down('field[name=export]');
> + const exportField = me.down('field[name=export]');
> exportField.setServer(value);
> exportField.setValue('');
> }
> @@ -143,6 +169,26 @@ Ext.define('PVE.storage.NFSInputPanel', {
> ];
>
> me.advancedColumn2 = [
> + {
> + xtype: 'textfield',
> + name: 'options',
> + fieldLabel: gettext('Mount Options'),
> + emptyText: `${gettext('Example')}: nconnect=4, soft`,
> + allowBlank: true,
> + deleteEmpty: !me.isCreate,
> + listeners: {
> + change: function (field, newValue) {
> + const hint = me.down('#mountOptionsHint');
> + if (hint) {
> + const currentVersion =
> + me.down('field[name=nfsversion]')?.getValue() || '__default__';
> + const isOptionsChanged = (newValue || '') !== me.originalOptions;
> + const isVersionChanged = currentVersion !== me.originalNfsVersion;
> + hint.setHidden(!(isOptionsChanged || isVersionChanged));
> + }
> + },
> + },
> + },
> {
> xtype: 'proxmoxKVComboBox',
> fieldLabel: gettext('NFS Version'),
> @@ -156,9 +202,32 @@ Ext.define('PVE.storage.NFSInputPanel', {
> ['4.1', '4.1'],
> ['4.2', '4.2'],
> ],
> + listeners: {
> + change: function (field, newValue) {
> + const hint = me.down('#mountOptionsHint');
> + if (hint) {
> + const currentOptions = me.down('field[name=options]')?.getValue() || '';
> + const isOptionsChanged = currentOptions !== me.originalOptions;
> + const isVersionChanged =
> + (newValue || '__default__') !== me.originalNfsVersion;
> + hint.setHidden(!(isOptionsChanged || isVersionChanged));
> + }
> + },
> + },
> },
> ];
>
> + me.advancedColumnB = me.advancedColumnB || [];
> + me.advancedColumnB.unshift({
> + xtype: 'displayfield',
> + itemId: 'mountOptionsHint',
> + userCls: 'pmx-hint',
> + hidden: true,
> + value: gettext(
> + 'Changes to mount options require remounting the storage to take effect.',
> + ),
> + });
> +
> me.callParent();
> },
> });
prev parent reply other threads:[~2026-07-24 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 15:03 [PATCH manager v2] fix #6855: ui: storage: add mount options field for nfs amd smb/cifs Elias Huhsovitz
2026-07-24 9:19 ` Max R. Carrara [this message]
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=DK6OU6EJCMXY.1WUVO53HQBABF@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=e.huhsovitz@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