[pve-devel] [PATCH pve-manager 3/3] add check if ceph-mgr is installed in create/destroymgr

Alwin Antreich a.antreich at proxmox.com
Mon Aug 14 09:36:13 CEST 2017


adding manager instances is only needed for upgrading PVE 4 to PVE 5

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/API2/Ceph.pm |  4 ++++
 PVE/CephTools.pm | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 11035e5b..6650f5ce 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -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