mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 03:25:43 +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) = @_;
|
||||
|
||||
PVE::Cluster::check_cfs_quorum();
|
||||
PVE::Ceph::Tools::check_ceph_inited();
|
||||
|
||||
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;
|
||||
PVE::Ceph::Tools::check_ceph_configured();
|
||||
|
||||
my $pool = $param->{name};
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
@ -786,12 +781,7 @@ __PACKAGE__->register_method ({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::Ceph::Tools::check_ceph_inited();
|
||||
|
||||
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;
|
||||
PVE::Ceph::Tools::check_ceph_configured();
|
||||
|
||||
my $rados = PVE::RADOS->new();
|
||||
|
||||
@ -825,12 +815,7 @@ __PACKAGE__->register_method ({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::Ceph::Tools::check_ceph_inited();
|
||||
|
||||
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;
|
||||
PVE::Ceph::Tools::check_ceph_configured();
|
||||
|
||||
my $set = $param->{set} // !$param->{unset};
|
||||
my $rados = PVE::RADOS->new();
|
||||
@ -868,12 +853,7 @@ __PACKAGE__->register_method ({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::Ceph::Tools::check_ceph_inited();
|
||||
|
||||
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;
|
||||
PVE::Ceph::Tools::check_ceph_configured();
|
||||
|
||||
my $set = $param->{set} // !$param->{unset};
|
||||
my $rados = PVE::RADOS->new();
|
||||
|
@ -121,11 +121,7 @@ __PACKAGE__->register_method ({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::Ceph::Tools::check_ceph_inited();
|
||||
|
||||
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;
|
||||
PVE::Ceph::Tools::check_ceph_configured();
|
||||
|
||||
my $fs_name = $param->{name} // 'cephfs';
|
||||
my $pg_num = $param->{pg_num} // 128;
|
||||
|
@ -109,6 +109,17 @@ sub check_ceph_installed {
|
||||
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 {
|
||||
my ($noerr) = @_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user