From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id F04467861F for ; Tue, 28 Jun 2022 12:34:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EDEE3A05C for ; Tue, 28 Jun 2022 12:34:06 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 40E18A051 for ; Tue, 28 Jun 2022 12:34:03 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 166F841909 for ; Tue, 28 Jun 2022 12:33:57 +0200 (CEST) Message-ID: <2cd2d083-e312-fd54-e77d-782bce413192@proxmox.com> Date: Tue, 28 Jun 2022 12:33:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: pve-devel@lists.proxmox.com, Stefan Hrdlicka References: <20220622143929.2757681-1-s.hrdlicka@proxmox.com> <20220622143929.2757681-2-s.hrdlicka@proxmox.com> From: Fabian Ebner In-Reply-To: <20220622143929.2757681-2-s.hrdlicka@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH V2 manager 1/3] fix #2822: add iscsi, lvm, lvmthin & zfs storage for all cluster nodes X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2022 10:34:07 -0000 Am 22.06.22 um 16:39 schrieb Stefan Hrdlicka: > This adds a dropdown box for iSCSI, LVM, LVMThin & ZFS storage options where a > cluster node needs to be chosen. As default the current node is > selected. It restricts the the storage to be only availabe on the > selected node. I don't think we should change the default restriction, especially for iSCSI and (shared) LVM, but also for local ones, as in many cases, cluster nodes will be set-up with similar storage and the new default might trip up some people. > > Signed-off-by: Stefan Hrdlicka > --- > www/manager6/storage/Base.js | 44 ++++++++++++++++++++++- > www/manager6/storage/IScsiEdit.js | 54 ++++++++++++++++++++++------- > www/manager6/storage/LVMEdit.js | 21 +++++++++-- > www/manager6/storage/LvmThinEdit.js | 35 ++++++++++++++----- > www/manager6/storage/ZFSPoolEdit.js | 24 ++++++++++--- > 5 files changed, 148 insertions(+), 30 deletions(-) > > diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js > index 7f6d7a09..bb497a5f 100644 > --- a/www/manager6/storage/Base.js > +++ b/www/manager6/storage/Base.js > @@ -34,8 +34,9 @@ Ext.define('PVE.panel.StorageBase', { > me.column2 = me.column2 || []; > me.column2.unshift( > { > - xtype: 'pveNodeSelector', > + xtype: 'pveScanNodeSelector', This class/type alias is never defined? And why change the restriction selector to a scan selector? > name: 'nodes', > + reference: 'storageNodeRestriction', > disabled: me.storageId === 'local', > fieldLabel: gettext('Nodes'), > emptyText: gettext('All') + ' (' + gettext('No restrictions') +')', > @@ -74,6 +75,47 @@ Ext.define('PVE.panel.StorageBase', { > > me.callParent(); > }, > + getPveScanNodeSelector: function() { No need for this function. The properties can be set as part of the class definition and overriden by the specific instances as needed. > + return { > + xtype: 'pveScanNodeSelector', > + name: 'node', > + itemId: 'pveScanNodeSelector', > + fieldLabel: gettext('Scan node'), > + allowBlank: false, > + disallowedNodes: undefined, > + onlineValidator: true, > + preferredValue: Proxmox.NodeName, > + submitValue: false, > + autoEl: { > + tag: 'div', > + 'data-qtip': gettext('Look for availabe storage options from selected node.'), "Look" and "from" sound a bit strange to me (also typo in "availabe"). Maybe "Scan for available storages on (the) selected node"? > + }, > + }; > + }, > +}); > + > +Ext.define('PVE.storage.ComboBoxSetStoreNode', { > + extend: 'Ext.form.field.ComboBox', > + config: { > + apiBaseUrl: '/api2/json/nodes/', > + apiStoragePath: '', > + }, > + > + setNodeName: function(value, storeLoad = true) { > + let me = this; > + if (value === null || value === '') { > + value = Proxmox.NodeName; > + } > + > + let store = me.getStore(); > + let proxy = store.getProxy(); > + proxy.setUrl(me.apiBaseUrl + value + me.apiStoragePath); > + this.clearValue(); > + if (storeLoad) { > + store.load(); > + } > + }, > + > }); > > Ext.define('PVE.storage.BaseEdit', { (...) > @@ -140,6 +145,20 @@ Ext.define('PVE.storage.LvmThinInputPanel', { > }, > }, > }); > + let pveScanNodeSelector = me.getPveScanNodeSelector(); > + pveScanNodeSelector.listeners = { > + change: { > + fn: function(field, value) { > + // don't reload the store, it requires a VG selected > + vgField.setNodeName(value, false); I'd rather drop the additional parameter from setNodeName and override it for this class. The class itself knows best when it can load and the 'vg' property should be reset as part of the setNodeName implementation. > + vgSelector.setNodeName(value); > + me.lookupReference('storageNodeRestriction').setValue(value); > + }, > + }, > + }; > + me.column1.push(pveScanNodeSelector); > + > + me.column1.push(vgSelector); > > me.column1.push(vgField); > }