}
sub get_pool_properties {
- my ($pool) = @_;
+ my ($pool, $rados) = @_;
+ $rados = PVE::RADOS->new() if !defined($rados);
my $command = {
prefix => "osd pool get",
pool => "$pool",
var => "all",
format => 'json',
};
-
- my $rados = PVE::RADOS->new();
return $rados->mon_command($command);
}
}
sub ecprofile_exists {
- my ($name) = @_;
+ my ($name, $rados) = @_;
+ $rados = PVE::RADOS->new() if !$rados;
- my $rados = PVE::RADOS->new();
my $res = $rados->mon_command({ prefix => 'osd erasure-code-profile ls' });
my $profiles = { map { $_ => 1 } @$res };
}
sub create_ecprofile {
- my ($name, $k, $m, $failure_domain, $device_class) = @_;
+ my ($name, $k, $m, $failure_domain, $device_class, $rados) = @_;
+ $rados = PVE::RADOS->new() if !$rados;
$failure_domain = 'host' if !$failure_domain;
push(@$profile, "crush-device-class=${device_class}") if $device_class;
- my $rados = PVE::RADOS->new();
$rados->mon_command({
prefix => 'osd erasure-code-profile set',
name => $name,
}
sub destroy_ecprofile {
- my ($profile) = @_;
+ my ($profile, $rados) = @_;
+ $rados = PVE::RADOS->new() if !$rados;
- my $rados = PVE::RADOS->new();
my $command = {
prefix => 'osd erasure-code-profile rm',
name => $profile,
}
sub destroy_crush_rule {
- my ($rule) = @_;
- my $rados = PVE::RADOS->new();
+ my ($rule, $rados) = @_;
+ $rados = PVE::RADOS->new() if !$rados;
+
my $command = {
prefix => 'osd crush rule rm',
name => $rule,