public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 2/3] fix #2515: ui: ceph pool create: use configured defaults for size and min_size
Date: Wed, 8 Mar 2023 13:14:59 +0100	[thread overview]
Message-ID: <53c2c865-7afd-0027-90c4-da9fdd817f9a@proxmox.com> (raw)
In-Reply-To: <20230113150930.857270-3-a.lauterer@proxmox.com>

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 <a.lauterer@proxmox.com>
> ---
>   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


>   			    },
>   			});
>   		    },




  reply	other threads:[~2023-03-08 12:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 15:09 [pve-devel] [PATCH manager 0/3] fix 2515 use default sizes for new ceph Aaron Lauterer
2023-01-13 15:09 ` [pve-devel] [PATCH manager 1/3] api: ceph: add endpoint to fetch config keys Aaron Lauterer
2023-03-08 12:14   ` Dominik Csapak
2023-03-11 17:07     ` Thomas Lamprecht
2023-03-13 12:58       ` Aaron Lauterer
2023-03-13 16:31         ` Thomas Lamprecht
2023-01-13 15:09 ` [pve-devel] [PATCH manager 2/3] fix #2515: ui: ceph pool create: use configured defaults for size and min_size Aaron Lauterer
2023-03-08 12:14   ` Dominik Csapak [this message]
2023-01-13 15:09 ` [pve-devel] [PATCH manager 3/3] ui: ceph pool edit: rework with controller and formulas Aaron Lauterer
2023-03-08 12:15   ` Dominik Csapak

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=53c2c865-7afd-0027-90c4-da9fdd817f9a@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=a.lauterer@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal