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.csa...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to