mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-05-02 16:59:36 +00:00
ceph tools: allow more rados connection reuse
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
3bd128d7a0
commit
23c407e59b
@ -256,15 +256,14 @@ sub set_pool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub get_pool_properties {
|
sub get_pool_properties {
|
||||||
my ($pool) = @_;
|
my ($pool, $rados) = @_;
|
||||||
|
$rados = PVE::RADOS->new() if !defined($rados);
|
||||||
my $command = {
|
my $command = {
|
||||||
prefix => "osd pool get",
|
prefix => "osd pool get",
|
||||||
pool => "$pool",
|
pool => "$pool",
|
||||||
var => "all",
|
var => "all",
|
||||||
format => 'json',
|
format => 'json',
|
||||||
};
|
};
|
||||||
|
|
||||||
my $rados = PVE::RADOS->new();
|
|
||||||
return $rados->mon_command($command);
|
return $rados->mon_command($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,9 +534,9 @@ sub ceph_cluster_status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub ecprofile_exists {
|
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 $res = $rados->mon_command({ prefix => 'osd erasure-code-profile ls' });
|
||||||
|
|
||||||
my $profiles = { map { $_ => 1 } @$res };
|
my $profiles = { map { $_ => 1 } @$res };
|
||||||
@ -545,7 +544,8 @@ sub ecprofile_exists {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub create_ecprofile {
|
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;
|
$failure_domain = 'host' if !$failure_domain;
|
||||||
|
|
||||||
@ -557,7 +557,6 @@ sub create_ecprofile {
|
|||||||
|
|
||||||
push(@$profile, "crush-device-class=${device_class}") if $device_class;
|
push(@$profile, "crush-device-class=${device_class}") if $device_class;
|
||||||
|
|
||||||
my $rados = PVE::RADOS->new();
|
|
||||||
$rados->mon_command({
|
$rados->mon_command({
|
||||||
prefix => 'osd erasure-code-profile set',
|
prefix => 'osd erasure-code-profile set',
|
||||||
name => $name,
|
name => $name,
|
||||||
@ -566,9 +565,9 @@ sub create_ecprofile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub destroy_ecprofile {
|
sub destroy_ecprofile {
|
||||||
my ($profile) = @_;
|
my ($profile, $rados) = @_;
|
||||||
|
$rados = PVE::RADOS->new() if !$rados;
|
||||||
|
|
||||||
my $rados = PVE::RADOS->new();
|
|
||||||
my $command = {
|
my $command = {
|
||||||
prefix => 'osd erasure-code-profile rm',
|
prefix => 'osd erasure-code-profile rm',
|
||||||
name => $profile,
|
name => $profile,
|
||||||
@ -583,8 +582,9 @@ sub get_ecprofile_name {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub destroy_crush_rule {
|
sub destroy_crush_rule {
|
||||||
my ($rule) = @_;
|
my ($rule, $rados) = @_;
|
||||||
my $rados = PVE::RADOS->new();
|
$rados = PVE::RADOS->new() if !$rados;
|
||||||
|
|
||||||
my $command = {
|
my $command = {
|
||||||
prefix => 'osd crush rule rm',
|
prefix => 'osd crush rule rm',
|
||||||
name => $rule,
|
name => $rule,
|
||||||
|
Loading…
Reference in New Issue
Block a user