]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Add better status message when adding new monitors 195/head
authorkfei <kfei@kfei.net>
Fri, 30 May 2014 08:50:53 +0000 (16:50 +0800)
committerkfei <kfei@kfei.net>
Fri, 30 May 2014 08:50:53 +0000 (16:50 +0800)
The `time.sleep(2)` in the `mon_add` method is not enough in some cases.
For example, when a low-spec slow VM acting as a monitor, it may still at
the state of 'probing' after the 2-seconds sleep. But in such cases the
`mon_status` method will just say the monitor *is not running*, it's kind of
confusion.

So maybe it would be better if provides user the current state of the
newly added monitor in the log message.

Signed-off-by: kfei <kfei@kfei.net>
ceph_deploy/mon.py

index 9b18f655876d45085aa8e6109acd3334f3bc913b..404b2b37a5be716c37fe1ed8f639124cbe393064 100644 (file)
@@ -99,6 +99,9 @@ def mon_status(conn, logger, hostname, args, silent=False):
         if out['rank'] >= 0:
             logger.info('monitor: %s is running' % mon)
             return True
+        if out['rank'] == -1 and out['state']:
+            logger.info('monitor: %s is currently at the state of %s' % (mon, out['state']))
+            return True
         logger.info('monitor: %s is not running' % mon)
         return False
     except RuntimeError: