From 10bf5123f8f9e2ccdc440c3d9be1dec1e7c3e7d5 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sun, 9 Oct 2016 10:21:20 +0800 Subject: [PATCH] mgr/MgrStandby: do not ignore result of init() of monc Which can fail due to missing keyring. Signed-off-by: xie xingguo --- src/mgr/MgrStandby.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index f555f791f1029..0beb8937d76ca 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -73,8 +73,14 @@ int MgrStandby::init() monc->set_want_keys(CEPH_ENTITY_TYPE_MON|CEPH_ENTITY_TYPE_OSD |CEPH_ENTITY_TYPE_MDS|CEPH_ENTITY_TYPE_MGR); monc->set_messenger(client_messenger); - monc->init(); - int r = monc->authenticate(); + int r = monc->init(); + if (r < 0) { + monc->shutdown(); + client_messenger->shutdown(); + client_messenger->wait(); + return r; + } + r = monc->authenticate(); if (r < 0) { derr << "Authentication failed, did you specify a mgr ID with a valid keyring?" << dendl; monc->shutdown(); -- 2.39.5