From 88a3d9d870157b0aea5528ca7b23f274c2dd5d60 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 22 Jan 2021 09:06:44 -0600 Subject: [PATCH] cephadm: try 'mgr stat' before 'mgr dump' to get the epoch This is less noise in the debug log. (Also, there seems to be a problem when the mgr stat output gets too big.) Signed-off-by: Sage Weil (cherry picked from commit c1cee0a9526b21c848e8eff2bed585ee856e4497) --- src/cephadm/cephadm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 54a6672d705e3..c3b0468f64677 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3731,8 +3731,13 @@ def command_bootstrap(ctx): # wait for mgr to restart (after enabling a module) def wait_for_mgr_restart(): - # first get latest mgrmap epoch from the mon - out = cli(['mgr', 'dump']) + # first get latest mgrmap epoch from the mon. try newer 'mgr + # stat' command first, then fall back to 'mgr dump' if + # necessary + try: + out = cli(['mgr', 'stat']) + except Exception as e: + out = cli(['mgr', 'dump']) j = json.loads(out) epoch = j['epoch'] # wait for mgr to have it -- 2.39.5