[pve-devel] [PATCH manager v2 3/3] add check if ceph-mgr is installed
Alwin Antreich
a.antreich at proxmox.com
Mon Aug 14 11:06:04 CEST 2017
in API endpoints createmgr/destroymgr/createmon
Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
changes in v2:
- add check with noerr to createmon as well
PVE/API2/Ceph.pm | 6 +++++-
PVE/CephTools.pm | 12 ++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 11035e5b..71ea687f 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1007,7 +1007,7 @@ __PACKAGE__->register_method ({
}
# create manager
- if (!$param->{'exclude-manager'}) {
+ if (!$param->{'exclude-manager'} && PVE::CephTools::check_ceph_mgr_installed(1)) {
$create_mgr->($rados, $monid);
}
};
@@ -1122,6 +1122,8 @@ __PACKAGE__->register_method ({
code => sub {
my ($param) = @_;
+ PVE::CephTools::check_ceph_mgr_installed();
+
PVE::CephTools::check_ceph_inited();
my $rpcenv = PVE::RPCEnvironment::get();
@@ -1170,6 +1172,8 @@ __PACKAGE__->register_method ({
my $authuser = $rpcenv->get_user();
+ PVE::CephTools::check_ceph_mgr_installed();
+
PVE::CephTools::check_ceph_inited();
my $mgrid = $param->{id};
diff --git a/PVE/CephTools.pm b/PVE/CephTools.pm
index 0c0d7c18..6f796374 100644
--- a/PVE/CephTools.pm
+++ b/PVE/CephTools.pm
@@ -21,6 +21,7 @@ my $ceph_bootstrap_osd_keyring = "/var/lib/ceph/bootstrap-osd/$ccname.keyring";
my $ceph_bootstrap_mds_keyring = "/var/lib/ceph/bootstrap-mds/$ccname.keyring";
my $ceph_bin = "/usr/bin/ceph";
+my $ceph_mgr_bin = "/usr/bin/ceph-mgr";
my $config_hash = {
ccname => $ccname,
@@ -70,6 +71,17 @@ sub check_ceph_installed {
return 1;
}
+sub check_ceph_mgr_installed {
+ my ($noerr) = @_;
+
+ if (! -x $ceph_mgr_bin) {
+ die "ceph-mgr binaries not installed\n" if !$noerr;
+ return undef;
+ }
+
+ return 1;
+}
+
sub check_ceph_inited {
my ($noerr) = @_;
--
2.11.0
More information about the pve-devel
mailing list