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 4E78F91EF for ; Wed, 8 Mar 2023 13:15:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3372F20220 for ; Wed, 8 Mar 2023 13:15:01 +0100 (CET) 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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 8 Mar 2023 13:15:00 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2795F45E50 for ; Wed, 8 Mar 2023 13:15:00 +0100 (CET) Message-ID: <53c2c865-7afd-0027-90c4-da9fdd817f9a@proxmox.com> Date: Wed, 8 Mar 2023 13:14:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Proxmox VE development discussion , Aaron Lauterer References: <20230113150930.857270-1-a.lauterer@proxmox.com> <20230113150930.857270-3-a.lauterer@proxmox.com> From: Dominik Csapak In-Reply-To: <20230113150930.857270-3-a.lauterer@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.061 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 Subject: Re: [pve-devel] [PATCH manager 2/3] fix #2515: ui: ceph pool create: use configured defaults for size and min_size 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: Wed, 08 Mar 2023 12:15:31 -0000 some comments inline: On 1/13/23 16:09, Aaron Lauterer wrote: > Instead of hard coded defaults for the size and min_size parameter, > check if we have defaults configured in the ceph.conf or config db and > use those. > > There are clusters where different defaults are needed. For example if > the cluster spans two rooms and needs to survive the loss of one. A > size/min_size of 4/2 are common defaults in such a situation. > > Signed-off-by: Aaron Lauterer > --- > www/manager6/ceph/Pool.js | 57 ++++++++++++++++++++++++++++++--------- > 1 file changed, 45 insertions(+), 12 deletions(-) > > diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js > index a1f008d1..86f83ffb 100644 > --- a/www/manager6/ceph/Pool.js > +++ b/www/manager6/ceph/Pool.js > @@ -27,7 +27,9 @@ Ext.define('PVE.CephPoolInputPanel', { > name: 'size', > editConfig: { > xtype: 'proxmoxintegerfield', > - value: 3, > + cbind: { > + value: (get) => get('defaultSize') ?? 3, > + }, > minValue: 2, > maxValue: 7, > allowBlank: false, > @@ -40,7 +42,6 @@ Ext.define('PVE.CephPoolInputPanel', { > }, > }, > }, > - > }, > ], > column2: [ > @@ -78,9 +79,15 @@ Ext.define('PVE.CephPoolInputPanel', { > xtype: 'proxmoxintegerfield', > fieldLabel: gettext('Min. Size'), > name: 'min_size', > - value: 2, > cbind: { > - minValue: (get) => get('isCreate') ? 2 : 1, > + value: (get) => get('defaultMinSize') ?? 2, > + minValue: (get) => { > + if (Number(get('defaultMinSize')) === 1) { > + return 1; > + } else { > + return get('isCreate') ? 2 : 1; > + } > + }, > }, > maxValue: 7, > allowBlank: false, > @@ -216,6 +223,8 @@ Ext.define('PVE.Ceph.PoolEdit', { > pool_name: '{pool_name}', > isErasure: '{isErasure}', > isCreate: '{isCreate}', > + defaultSize: '{defaultSize}', > + defaultMinSize: '{defaultMinSize}', > }, > }], > }); > @@ -372,6 +381,8 @@ Ext.define('PVE.node.Ceph.PoolList', { > Ext.create('PVE.Ceph.PoolEdit', { > title: gettext('Edit') + ': Ceph Pool', > nodename: nodename, > + defaultSize: undefined, > + defaultMinSize: undefined, i guess you did it for clarity, but it should not be necessary to pass config that is undefined... i'd rather document them in the class and set them there to undefined > pool_name: rec.data.pool_name, > isErasure: rec.data.type === 'erasure', > autoShow: true, > @@ -388,14 +399,36 @@ Ext.define('PVE.node.Ceph.PoolList', { > { > text: gettext('Create'), > handler: function() { > - Ext.create('PVE.Ceph.PoolEdit', { > - title: gettext('Create') + ': Ceph Pool', > - isCreate: true, > - isErasure: false, > - nodename: nodename, > - autoShow: true, > - listeners: { > - destroy: () => rstore.load(), > + let keys = [ > + 'global:osd-pool-default-min-size', > + 'global:osd-pool-default-size', > + ]; > + let params = { > + 'config_keys': keys.join(';'), > + }; > + > + Proxmox.Utils.API2Request({ > + url: '/nodes/localhost/ceph/configkey', > + method: 'GET', > + params, > + failure: response => Ext.Msg.alert(gettext('Error'), response.htmlStatus), > + success: function({ result: { data } }) { > + let global = data.global; > + let defaultSize = global.osd_pool_default_size; > + let defaultMinSize = global.osd_pool_default_min_size; > + > + Ext.create('PVE.Ceph.PoolEdit', { > + title: gettext('Create') + ': Ceph Pool', > + isCreate: true, > + isErasure: false, > + defaultSize, > + defaultMinSize, > + nodename: nodename, > + autoShow: true, > + listeners: { > + destroy: () => rstore.load(), > + }, > + }); one slight problem i see with that is that the user has no indication that something is loading when clicking the button... you can use the 'waitMsgTarget' of the API2Request to show a 'loading...' mask on the grid > }, > }); > },