]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/API2/Ceph/Pools.pm
Revert "ui: add beta text with link to bugtracker"
[pve-manager.git] / PVE / API2 / Ceph / Pools.pm
index 975cc1027b0070db96235588620d45517c98357d..ffae73b935fce95f1cdf67ad2bbd9ac6af89e842 100644 (file)
@@ -1,4 +1,5 @@
 package PVE::API2::Ceph::Pools;
+# TODO: Deprecated, drop with PVE 8.0! PVE::API2::Ceph::Pool is the replacement
 
 use strict;
 use warnings;
@@ -37,7 +38,7 @@ __PACKAGE__->register_method ({
     name => 'lspools',
     path => '',
     method => 'GET',
-    description => "List all pools.",
+    description => "List all pools. Deprecated, please use `/nodes/{node}/ceph/pool`.",
     proxyto => 'node',
     protected => 1,
     permissions => {
@@ -66,6 +67,11 @@ __PACKAGE__->register_method ({
                    type => 'integer',
                    title => 'Size',
                },
+               type => {
+                   type => 'string',
+                   title => 'Type',
+                   enum => ['replicated', 'erasure', 'unknown'],
+               },
                min_size => {
                    type => 'integer',
                    title => 'Min Size',
@@ -120,6 +126,11 @@ __PACKAGE__->register_method ({
                    title => 'Autoscale Status',
                    optional => 1,
                },
+               application_metadata => {
+                   type => 'object',
+                   title => 'Associated Applications',
+                   optional => 1,
+               },
            },
        },
        links => [ { rel => 'child', href => "{pool_name}" } ],
@@ -157,6 +168,7 @@ __PACKAGE__->register_method ({
            'pg_num',
            'crush_rule',
            'pg_autoscale_mode',
+           'application_metadata',
        ];
 
        # pg_autoscaler module is not enabled in Nautilus
@@ -185,6 +197,17 @@ __PACKAGE__->register_method ({
                $d->{bytes_used} = $s->{bytes_used};
                $d->{percent_used} = $s->{percent_used};
            }
+
+           # Cephs numerical pool types are barely documented. Found the following in the Ceph
+           # codebase: https://github.com/ceph/ceph/blob/ff144995a849407c258bcb763daa3e03cfce5059/src/osd/osd_types.h#L1221-L1233
+           if ($e->{type} == 1) {
+               $d->{type} = 'replicated';
+           } elsif ($e->{type} == 3) {
+               $d->{type} = 'erasure';
+           } else {
+               # we should never get here, but better be safe
+               $d->{type} = 'unknown';
+           }
            push @$data, $d;
        }
 
@@ -305,6 +328,7 @@ my $get_storages = sub {
     foreach my $storeid (keys %$storages) {
        my $curr = $storages->{$storeid};
        next if $curr->{type} ne 'rbd';
+       $curr->{pool} = 'rbd' if !defined $curr->{pool}; # set default
        if (
            $pool eq $curr->{pool} ||
            (defined $curr->{'data-pool'} && $pool eq $curr->{'data-pool'})
@@ -370,7 +394,7 @@ __PACKAGE__->register_method ({
     name => 'createpool',
     path => '',
     method => 'POST',
-    description => "Create Ceph pool",
+    description => "Create Ceph pool. Deprecated, please use `/nodes/{node}/ceph/pool`.",
     proxyto => 'node',
     protected => 1,
     permissions => {
@@ -387,8 +411,9 @@ __PACKAGE__->register_method ({
                default => "0; for erasure coded pools: 1",
            },
            'erasure-coding' => {
-               description => "Create an erasure coded pool for RBD with an ".
-                               "accompaning replicated pool for metadata storage.",
+               description => "Create an erasure coded pool for RBD with an accompaning"
+                   ." replicated pool for metadata storage. With EC, the common ceph options 'size',"
+                   ." 'min_size' and 'crush_rule' parameters will be applied to the metadata pool.",
                type => 'string',
                format => $ec_format,
                optional => 1,
@@ -458,6 +483,7 @@ __PACKAGE__->register_method ({
                $ec_data_param->{erasure_code_profile} = $ec->{profile};
                delete $ec_data_param->{size};
                delete $ec_data_param->{min_size};
+               delete $ec_data_param->{crush_rule};
 
                # metadata pool should be ok with 32 PGs
                $param->{pg_num} = 32;
@@ -484,7 +510,7 @@ __PACKAGE__->register_method ({
     name => 'destroypool',
     path => '{name}',
     method => 'DELETE',
-    description => "Destroy pool",
+    description => "Destroy pool. Deprecated, please use `/nodes/{node}/ceph/pool/{name}`.",
     proxyto => 'node',
     protected => 1,
     permissions => {
@@ -590,7 +616,7 @@ __PACKAGE__->register_method ({
     name => 'setpool',
     path => '{name}',
     method => 'PUT',
-    description => "Change POOL settings",
+    description => "Change POOL settings. Deprecated, please use `/nodes/{node}/ceph/pool/{name}`.",
     proxyto => 'node',
     protected => 1,
     permissions => {
@@ -633,7 +659,7 @@ __PACKAGE__->register_method ({
     name => 'getpool',
     path => '{name}',
     method => 'GET',
-    description => "List pool settings.",
+    description => "List pool settings. Deprecated, please use `/nodes/{node}/ceph/pool/{pool}/status`.",
     proxyto => 'node',
     protected => 1,
     permissions => {