[pve-devel] applied: [PATCH manager 1/2] ceph: add osd scrub api call
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Jul 11 14:22:14 CEST 2019
On 7/10/19 3:13 PM, Dominik Csapak wrote:
> can be called to (deep) scrub a specific osd
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> is there a better permission we could use? (since we do not know the
> storage name?)
> PVE/API2/Ceph/OSD.pm | 45 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
> index 85197107..0582d538 100644
> --- a/PVE/API2/Ceph/OSD.pm
> +++ b/PVE/API2/Ceph/OSD.pm
> @@ -650,4 +650,49 @@ __PACKAGE__->register_method ({
> return undef;
> }});
>
> +__PACKAGE__->register_method ({
> + name => 'scrub',
> + path => '{osdid}/scrub',
> + method => 'POST',
> + description => "Instruct the OSD to scrub.",
> + proxyto => 'node',
> + protected => 1,
> + permissions => {
> + check => ['perm', '/', [ 'Sys.Modify' ]],
> + },
> + parameters => {
> + additionalProperties => 0,
> + properties => {
> + node => get_standard_option('pve-node'),
> + osdid => {
> + description => 'OSD ID',
> + type => 'integer',
> + },
> + deep => {
> + description => 'If set, instructs a deep scrub instead of a normal one.',
> + type => 'boolean',
> + optional => 1,
> + default => 0,
> + },
> + },
> + },
> + returns => { type => "null" },
> + code => sub {
> + my ($param) = @_;
> +
> + PVE::Ceph::Tools::check_ceph_inited();
> +
> + my $osdid = $param->{osdid};
> + my $deep = $param->{deep} // 0;
> +
> + my $rados = PVE::RADOS->new();
> +
> + my $osdstat = &$get_osd_status($rados, $osdid); # osd exists?
> + my $prefix = $deep ? 'osd deep-scrub' : 'osd scrub';
> +
> + $rados->mon_command({ prefix => $prefix, who => $osdid });
> +
> + return undef;
> + }});
> +
> 1;
>
applied, thanks!
More information about the pve-devel
mailing list