mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-16 13:01:29 +00:00
ceph tools: factor out frequent keyring and config init check
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e1ed931dd9
commit
7ef69f338e
@ -725,12 +725,7 @@ __PACKAGE__->register_method ({
|
|||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
PVE::Cluster::check_cfs_quorum();
|
PVE::Cluster::check_cfs_quorum();
|
||||||
PVE::Ceph::Tools::check_ceph_inited();
|
PVE::Ceph::Tools::check_ceph_configured();
|
||||||
|
|
||||||
my $pve_ckeyring_path = PVE::Ceph::Tools::get_config('pve_ckeyring_path');
|
|
||||||
|
|
||||||
die "not fully configured - missing '$pve_ckeyring_path'\n"
|
|
||||||
if ! -f $pve_ckeyring_path;
|
|
||||||
|
|
||||||
my $pool = $param->{name};
|
my $pool = $param->{name};
|
||||||
my $rpcenv = PVE::RPCEnvironment::get();
|
my $rpcenv = PVE::RPCEnvironment::get();
|
||||||
@ -786,12 +781,7 @@ __PACKAGE__->register_method ({
|
|||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
PVE::Ceph::Tools::check_ceph_inited();
|
PVE::Ceph::Tools::check_ceph_configured();
|
||||||
|
|
||||||
my $pve_ckeyring_path = PVE::Ceph::Tools::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 $rados = PVE::RADOS->new();
|
||||||
|
|
||||||
@ -825,12 +815,7 @@ __PACKAGE__->register_method ({
|
|||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
PVE::Ceph::Tools::check_ceph_inited();
|
PVE::Ceph::Tools::check_ceph_configured();
|
||||||
|
|
||||||
my $pve_ckeyring_path = PVE::Ceph::Tools::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 $set = $param->{set} // !$param->{unset};
|
||||||
my $rados = PVE::RADOS->new();
|
my $rados = PVE::RADOS->new();
|
||||||
@ -868,12 +853,7 @@ __PACKAGE__->register_method ({
|
|||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
PVE::Ceph::Tools::check_ceph_inited();
|
PVE::Ceph::Tools::check_ceph_configured();
|
||||||
|
|
||||||
my $pve_ckeyring_path = PVE::Ceph::Tools::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 $set = $param->{set} // !$param->{unset};
|
||||||
my $rados = PVE::RADOS->new();
|
my $rados = PVE::RADOS->new();
|
||||||
|
@ -121,11 +121,7 @@ __PACKAGE__->register_method ({
|
|||||||
code => sub {
|
code => sub {
|
||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
PVE::Ceph::Tools::check_ceph_inited();
|
PVE::Ceph::Tools::check_ceph_configured();
|
||||||
|
|
||||||
my $pve_ckeyring_path = PVE::Ceph::Tools::get_config('pve_ckeyring_path');
|
|
||||||
die "Ceph is not fully configured - missing '$pve_ckeyring_path'\n"
|
|
||||||
if ! -f $pve_ckeyring_path;
|
|
||||||
|
|
||||||
my $fs_name = $param->{name} // 'cephfs';
|
my $fs_name = $param->{name} // 'cephfs';
|
||||||
my $pg_num = $param->{pg_num} // 128;
|
my $pg_num = $param->{pg_num} // 128;
|
||||||
|
@ -109,6 +109,17 @@ sub check_ceph_installed {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub check_ceph_configured {
|
||||||
|
|
||||||
|
check_ceph_inited();
|
||||||
|
|
||||||
|
die "ceph not fully configured - missing '$pve_ckeyring_path'\n"
|
||||||
|
if ! -f $pve_ckeyring_path;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
sub check_ceph_inited {
|
sub check_ceph_inited {
|
||||||
my ($noerr) = @_;
|
my ($noerr) = @_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user