mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-16 07:30:40 +00:00
add ceph flags api calls
we add a get/post/delete api call for ceph flags Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
85c17d9673
commit
a46ad02adb
121
PVE/API2/Ceph.pm
121
PVE/API2/Ceph.pm
@ -535,6 +535,7 @@ __PACKAGE__->register_method ({
|
|||||||
{ name => 'config' },
|
{ name => 'config' },
|
||||||
{ name => 'log' },
|
{ name => 'log' },
|
||||||
{ name => 'disks' },
|
{ name => 'disks' },
|
||||||
|
{ name => 'flags' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -1311,6 +1312,126 @@ __PACKAGE__->register_method ({
|
|||||||
return undef;
|
return undef;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
__PACKAGE__->register_method ({
|
||||||
|
name => 'get_flags',
|
||||||
|
path => 'flags',
|
||||||
|
method => 'GET',
|
||||||
|
description => "get all set ceph flags",
|
||||||
|
proxyto => 'node',
|
||||||
|
protected => 1,
|
||||||
|
permissions => {
|
||||||
|
check => ['perm', '/', [ 'Sys.Audit' ]],
|
||||||
|
},
|
||||||
|
parameters => {
|
||||||
|
additionalProperties => 0,
|
||||||
|
properties => {
|
||||||
|
node => get_standard_option('pve-node'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
returns => { type => 'string' },
|
||||||
|
code => sub {
|
||||||
|
my ($param) = @_;
|
||||||
|
|
||||||
|
PVE::CephTools::check_ceph_inited();
|
||||||
|
|
||||||
|
my $pve_ckeyring_path = PVE::CephTools::get_config('pve_ckeyring_path');
|
||||||
|
|
||||||
|
die "not fully configured - missing '$pve_ckeyring_path'\n"
|
||||||
|
if ! -f $pve_ckeyring_path;
|
||||||
|
|
||||||
|
my $rados = PVE::RADOS->new();
|
||||||
|
|
||||||
|
my $stat = $rados->mon_command({ prefix => 'osd dump' });
|
||||||
|
|
||||||
|
return $stat->{flags} // '';
|
||||||
|
}});
|
||||||
|
|
||||||
|
__PACKAGE__->register_method ({
|
||||||
|
name => 'set_flag',
|
||||||
|
path => 'flags/{flag}',
|
||||||
|
method => 'POST',
|
||||||
|
description => "Set a ceph flag",
|
||||||
|
proxyto => 'node',
|
||||||
|
protected => 1,
|
||||||
|
permissions => {
|
||||||
|
check => ['perm', '/', [ 'Sys.Modify' ]],
|
||||||
|
},
|
||||||
|
parameters => {
|
||||||
|
additionalProperties => 0,
|
||||||
|
properties => {
|
||||||
|
node => get_standard_option('pve-node'),
|
||||||
|
flag => {
|
||||||
|
description => 'The ceph flag to set/unset',
|
||||||
|
type => 'string',
|
||||||
|
enum => [ 'full', 'pause', 'noup', 'nodown', 'noout', 'noin', 'nobackfill', 'norebalance', 'norecover', 'noscrub', 'nodeep-scrub', 'notieragent'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
returns => { type => 'null' },
|
||||||
|
code => sub {
|
||||||
|
my ($param) = @_;
|
||||||
|
|
||||||
|
PVE::CephTools::check_ceph_inited();
|
||||||
|
|
||||||
|
my $pve_ckeyring_path = PVE::CephTools::get_config('pve_ckeyring_path');
|
||||||
|
|
||||||
|
die "not fully configured - missing '$pve_ckeyring_path'\n"
|
||||||
|
if ! -f $pve_ckeyring_path;
|
||||||
|
|
||||||
|
my $set = $param->{set} // !$param->{unset};
|
||||||
|
my $rados = PVE::RADOS->new();
|
||||||
|
|
||||||
|
$rados->mon_command({
|
||||||
|
prefix => "osd set",
|
||||||
|
key => $param->{flag},
|
||||||
|
});
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}});
|
||||||
|
|
||||||
|
__PACKAGE__->register_method ({
|
||||||
|
name => 'unset_flag',
|
||||||
|
path => 'flags/{flag}',
|
||||||
|
method => 'DELETE',
|
||||||
|
description => "Unset a ceph flag",
|
||||||
|
proxyto => 'node',
|
||||||
|
protected => 1,
|
||||||
|
permissions => {
|
||||||
|
check => ['perm', '/', [ 'Sys.Modify' ]],
|
||||||
|
},
|
||||||
|
parameters => {
|
||||||
|
additionalProperties => 0,
|
||||||
|
properties => {
|
||||||
|
node => get_standard_option('pve-node'),
|
||||||
|
flag => {
|
||||||
|
description => 'The ceph flag to set/unset',
|
||||||
|
type => 'string',
|
||||||
|
enum => [ 'full', 'pause', 'noup', 'nodown', 'noout', 'noin', 'nobackfill', 'norebalance', 'norecover', 'noscrub', 'nodeep-scrub', 'notieragent'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
returns => { type => 'null' },
|
||||||
|
code => sub {
|
||||||
|
my ($param) = @_;
|
||||||
|
|
||||||
|
PVE::CephTools::check_ceph_inited();
|
||||||
|
|
||||||
|
my $pve_ckeyring_path = PVE::CephTools::get_config('pve_ckeyring_path');
|
||||||
|
|
||||||
|
die "not fully configured - missing '$pve_ckeyring_path'\n"
|
||||||
|
if ! -f $pve_ckeyring_path;
|
||||||
|
|
||||||
|
my $set = $param->{set} // !$param->{unset};
|
||||||
|
my $rados = PVE::RADOS->new();
|
||||||
|
|
||||||
|
$rados->mon_command({
|
||||||
|
prefix => "osd unset",
|
||||||
|
key => $param->{flag},
|
||||||
|
});
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}});
|
||||||
|
|
||||||
__PACKAGE__->register_method ({
|
__PACKAGE__->register_method ({
|
||||||
name => 'destroypool',
|
name => 'destroypool',
|
||||||
path => 'pools/{name}',
|
path => 'pools/{name}',
|
||||||
|
Loading…
Reference in New Issue
Block a user