]> git.proxmox.com Git - pve-manager.git/commitdiff
ceph: add api call for config database
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 5 Jul 2019 07:16:33 +0000 (09:16 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 5 Jul 2019 07:52:58 +0000 (09:52 +0200)
simply returns the database content

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/API2/Ceph.pm

index a1ae7020beee777dd3e324fd67ea8e99109656df..9c7b0dde8298cb3015be9671b731256af2614ff1 100644 (file)
@@ -195,6 +195,50 @@ __PACKAGE__->register_method ({
 
     }});
 
+__PACKAGE__->register_method ({
+    name => 'configdb',
+    path => 'configdb',
+    method => 'GET',
+    proxyto => 'node',
+    protected => 1,
+    permissions => {
+       check => ['perm', '/', [ 'Sys.Audit', 'Datastore.Audit' ], any => 1],
+    },
+    description => "Get Ceph configuration database.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+       },
+    },
+    returns => {
+       type => 'array',
+       items => {
+           type => 'object',
+           properties => {
+               section => { type => "string", },
+               name => { type => "string", },
+               value => { type => "string", },
+               level => { type => "string", },
+               'can_update_at_runtime' => { type => "boolean", },
+               mask => { type => "string" },
+           },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       PVE::Ceph::Tools::check_ceph_inited();
+
+       my $rados = PVE::RADOS->new();
+       my $res = $rados->mon_command( { prefix => 'config dump', format => 'json' });
+       foreach my $entry (@$res) {
+           $entry->{can_update_at_runtime} = $entry->{can_update_at_runtime}? 1 : 0; # JSON::true/false -> 1/0
+       }
+
+       return $res;
+    }});
+
 my $add_storage = sub {
     my ($pool, $storeid) = @_;