public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset
@ 2024-03-06 14:14 Maximiliano Sandoval
  2024-03-06 15:08 ` Fiona Ebner
  0 siblings, 1 reply; 4+ messages in thread
From: Maximiliano Sandoval @ 2024-03-06 14:14 UTC (permalink / raw)
  To: pve-devel

If the pool has a target_size_ratio set it might be desirable to unset
its value, e.g. if set by mistake on .mgr.

Currently unsetting the value won't do anything in the web UI. With this
patch it is set to zero, which the API correctly understands and unsets
it.

one can verify the value set using

    $ ceph osd pool get <POOL_NAME> target_size_ratio

after setting the valut to 0 through the API it will output

    Error ENOENT: option 'target_size_ratio' is not set on pool 'cephfs-test_data'

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 www/manager6/ceph/Pool.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
index c61d4f71..224f3cea 100644
--- a/www/manager6/ceph/Pool.js
+++ b/www/manager6/ceph/Pool.js
@@ -226,7 +226,11 @@ Ext.define('PVE.CephPoolInputPanel', {
     onGetValues: function(values) {
 	Object.keys(values || {}).forEach(function(name) {
 	    if (values[name] === '') {
-		delete values[name];
+		if (name === 'target_size_ratio') {
+		    values[name] = 0;
+		} else {
+		    delete values[name];
+		}
 	    }
 	});
 
-- 
2.39.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset
  2024-03-06 14:14 [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset Maximiliano Sandoval
@ 2024-03-06 15:08 ` Fiona Ebner
  2024-03-06 15:17   ` Maximiliano Sandoval
  0 siblings, 1 reply; 4+ messages in thread
From: Fiona Ebner @ 2024-03-06 15:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Maximiliano Sandoval

Am 06.03.24 um 15:14 schrieb Maximiliano Sandoval:
> If the pool has a target_size_ratio set it might be desirable to unset
> its value, e.g. if set by mistake on .mgr.
> 
> Currently unsetting the value won't do anything in the web UI. With this
> patch it is set to zero, which the API correctly understands and unsets
> it.
> 
> one can verify the value set using
> 
>     $ ceph osd pool get <POOL_NAME> target_size_ratio
> 
> after setting the valut to 0 through the API it will output
> 
>     Error ENOENT: option 'target_size_ratio' is not set on pool 'cephfs-test_data'
> 
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
>  www/manager6/ceph/Pool.js | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/ceph/Pool.js b/www/manager6/ceph/Pool.js
> index c61d4f71..224f3cea 100644
> --- a/www/manager6/ceph/Pool.js
> +++ b/www/manager6/ceph/Pool.js
> @@ -226,7 +226,11 @@ Ext.define('PVE.CephPoolInputPanel', {
>      onGetValues: function(values) {
>  	Object.keys(values || {}).forEach(function(name) {
>  	    if (values[name] === '') {
> -		delete values[name];
> +		if (name === 'target_size_ratio') {
> +		    values[name] = 0;
> +		} else {
> +		    delete values[name];
> +		}
>  	    }
>  	});
>  

It might be cleaner to just use
emptyValue: 0,
in the field declaration like is already done for the "Target Size"
field. And the same issue is also present for the "Min. # of PGs" field,
right?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset
  2024-03-06 15:08 ` Fiona Ebner
@ 2024-03-06 15:17   ` Maximiliano Sandoval
  2024-03-06 15:38     ` Fiona Ebner
  0 siblings, 1 reply; 4+ messages in thread
From: Maximiliano Sandoval @ 2024-03-06 15:17 UTC (permalink / raw)
  To: Fiona Ebner; +Cc: Proxmox VE development discussion

Fiona Ebner <f.ebner@proxmox.com> writes:

> It might be cleaner to just use
> emptyValue: 0,
> in the field declaration like is already done for the "Target Size"
> field. And the same issue is also present for the "Min. # of PGs" field,
> right?

Thanks for the emptyValue tip, I didn't know about it. Unfortunately, I
tested this and it didn't work.

--
Maximiliano




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset
  2024-03-06 15:17   ` Maximiliano Sandoval
@ 2024-03-06 15:38     ` Fiona Ebner
  0 siblings, 0 replies; 4+ messages in thread
From: Fiona Ebner @ 2024-03-06 15:38 UTC (permalink / raw)
  To: Maximiliano Sandoval; +Cc: Proxmox VE development discussion

Am 06.03.24 um 16:17 schrieb Maximiliano Sandoval:
> Fiona Ebner <f.ebner@proxmox.com> writes:
> 
>> It might be cleaner to just use
>> emptyValue: 0,
>> in the field declaration like is already done for the "Target Size"
>> field. And the same issue is also present for the "Min. # of PGs" field,
>> right?
> 
> Thanks for the emptyValue tip, I didn't know about it. Unfortunately, I
> tested this and it didn't work.
> 

Yes, sorry. Unfortunately, that is a feature specific to
PVE.form.SizeField, respectively Proxmox.form.SizeField.

For the "Min. # of PGs" field, we could add a similar feature to
proxmoxintegerfield. And the "Target Ratio" field is just a numberfield,
so would need yet another instance of the feature. So maybe not worth it.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-06 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06 14:14 [pve-devel] [PATCH manager] ceph: pool edit: set target ratio to 0 when the value is unset Maximiliano Sandoval
2024-03-06 15:08 ` Fiona Ebner
2024-03-06 15:17   ` Maximiliano Sandoval
2024-03-06 15:38     ` Fiona Ebner

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