public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint
@ 2022-10-25  8:10 Stefan Sterz
  2022-10-25  8:10 ` [pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage Stefan Sterz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Sterz @ 2022-10-25  8:10 UTC (permalink / raw)
  To: pve-devel

since ceph luminous (ceph 12) pools need to be associated with at
least one applicaton. expose this information here too so that clients
of this endpoint can use it.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
v3: add an api viewer entry for the applications object.
v4: re-use the 'osd dump' command's result instead of issueing another 
    command.

thanks @ alwin antreich for pointing out that pools have applications!

 PVE/API2/Ceph/Pools.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..fce56787 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
 		    title => 'Autoscale Status',
 		    optional => 1,
 		},
+		application_metadata => {
+		    type => 'object',
+		    title => 'Associated Applications',
+		    optional => 1,
+		},
 	    },
 	},
 	links => [ { rel => 'child', href => "{pool_name}" } ],
@@ -162,6 +167,7 @@ __PACKAGE__->register_method ({
 	    'pg_num',
 	    'crush_rule',
 	    'pg_autoscale_mode',
+	    'application_metadata',
 	];
 
 	# pg_autoscaler module is not enabled in Nautilus
-- 
2.30.2





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

* [pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage
  2022-10-25  8:10 [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Stefan Sterz
@ 2022-10-25  8:10 ` Stefan Sterz
  2022-10-25  8:36 ` [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Aaron Lauterer
  2022-11-16 19:25 ` [pve-devel] applied-series: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Sterz @ 2022-10-25  8:10 UTC (permalink / raw)
  To: pve-devel

previously the ui would allow adding all pools (even the default
ceph-mon pools) as storage. this could lead to issues when users did
use these pools as storage (e.g.: vms missing their disks after a
migration). hence, restrict the pool selector to rbd pools.

fails gracefully by reverting to the previous behavior if a pool has
no application assigned to it.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
v3: changed the name of the filter function based on alwin antreich's
    suggestion.
v4: renamed the filter function again a, adapted it to be more concise
    and make it work with the slightly adapted api response.

 www/manager6/form/CephPoolSelector.js | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/CephPoolSelector.js b/www/manager6/form/CephPoolSelector.js
index 5b96398d..e8197077 100644
--- a/www/manager6/form/CephPoolSelector.js
+++ b/www/manager6/form/CephPoolSelector.js
@@ -15,9 +15,15 @@ Ext.define('PVE.form.CephPoolSelector', {
 	    throw "no nodename given";
 	}
 
+	let onlyRBDPools = ({ data }) =>
+	    !data?.application_metadata || !!data?.application_metadata?.rbd;
+
 	var store = Ext.create('Ext.data.Store', {
 	    fields: ['name'],
 	    sorters: 'name',
+	    filters: [
+		onlyRBDPools,
+	    ],
 	    proxy: {
 		type: 'proxmox',
 		url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
@@ -32,8 +38,10 @@ Ext.define('PVE.form.CephPoolSelector', {
 
 	store.load({
 	    callback: function(rec, op, success) {
-		if (success && rec.length > 0) {
-		    me.select(rec[0]);
+		let filteredRec = rec.filter(onlyRBDPools);
+
+		if (success && filteredRec.length > 0) {
+		    me.select(filteredRec[0]);
 		}
 	    },
 	});
-- 
2.30.2





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

* Re: [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint
  2022-10-25  8:10 [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Stefan Sterz
  2022-10-25  8:10 ` [pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage Stefan Sterz
@ 2022-10-25  8:36 ` Aaron Lauterer
  2022-11-16 19:25 ` [pve-devel] applied-series: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Lauterer @ 2022-10-25  8:36 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

works well and now also hides the ceph fs pools, further reducing the chances to 
build weird constellations :)

for the series:

Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>

On 10/25/22 10:10, Stefan Sterz wrote:
> since ceph luminous (ceph 12) pools need to be associated with at
> least one applicaton. expose this information here too so that clients
> of this endpoint can use it.
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
> v3: add an api viewer entry for the applications object.
> v4: re-use the 'osd dump' command's result instead of issueing another
>      command.
> 
> thanks @ alwin antreich for pointing out that pools have applications!
> 
>   PVE/API2/Ceph/Pools.pm | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
> index 6c05250e..fce56787 100644
> --- a/PVE/API2/Ceph/Pools.pm
> +++ b/PVE/API2/Ceph/Pools.pm
> @@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
>   		    title => 'Autoscale Status',
>   		    optional => 1,
>   		},
> +		application_metadata => {
> +		    type => 'object',
> +		    title => 'Associated Applications',
> +		    optional => 1,
> +		},
>   	    },
>   	},
>   	links => [ { rel => 'child', href => "{pool_name}" } ],
> @@ -162,6 +167,7 @@ __PACKAGE__->register_method ({
>   	    'pg_num',
>   	    'crush_rule',
>   	    'pg_autoscale_mode',
> +	    'application_metadata',
>   	];
>   
>   	# pg_autoscaler module is not enabled in Nautilus




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

* [pve-devel] applied-series: [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint
  2022-10-25  8:10 [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Stefan Sterz
  2022-10-25  8:10 ` [pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage Stefan Sterz
  2022-10-25  8:36 ` [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Aaron Lauterer
@ 2022-11-16 19:25 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2022-11-16 19:25 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Sterz

Am 25/10/2022 um 10:10 schrieb Stefan Sterz:
> since ceph luminous (ceph 12) pools need to be associated with at
> least one applicaton. expose this information here too so that clients
> of this endpoint can use it.
> 
> Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
> ---
> v3: add an api viewer entry for the applications object.
> v4: re-use the 'osd dump' command's result instead of issueing another 
>     command.
> 
> thanks @ alwin antreich for pointing out that pools have applications!
> 
>  PVE/API2/Ceph/Pools.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
>

applied both patches with Aaron's T-b tag, thanks!




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

end of thread, other threads:[~2022-11-16 19:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25  8:10 [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Stefan Sterz
2022-10-25  8:10 ` [pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage Stefan Sterz
2022-10-25  8:36 ` [pve-devel] [PATCH manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint Aaron Lauterer
2022-11-16 19:25 ` [pve-devel] applied-series: " Thomas Lamprecht

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