[pve-devel] [PATCH manager] fix creating the first ceph monitor

Dominik Csapak d.csapak at proxmox.com
Thu Jul 27 15:02:41 CEST 2017


we cannot use a rados connection before having at least one monitor,
so we have to move it down

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index eb8f14f3..f13ae9f1 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1002,14 +1002,13 @@ __PACKAGE__->register_method ({
 
 	    my $monmap = "/tmp/monmap";
 
-	    my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
-
 	    eval {
 		mkdir $mondir;
 
 		run_command("chown ceph:ceph $mondir") if $systemd_managed;
 
 		if ($moncount > 0) {
+		    my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
 		    my $mapdata = $rados->mon_command({ prefix => 'mon getmap', format => 'plain' });
 		    PVE::Tools::file_set_contents($monmap, $mapdata);
 		} else {
@@ -1051,6 +1050,7 @@ __PACKAGE__->register_method ({
 
 	    # create manager
 	    if (!$param->{'exclude-manager'}) {
+		my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
 		$create_mgr->($rados, $monid);
 	    }
 	};
-- 
2.11.0





More information about the pve-devel mailing list