import ceph_module # noqa
import logging
+import json
import six
import threading
try:
except ImportError:
from collections import defaultdict
import rados
+import time
PG_STATES = [
"active",
"""
return self._ceph_get_daemon_status(svc_type, svc_id)
+ def mon_command(self, cmd_dict):
+ """
+ Helper for modules that do simple, synchronous mon command
+ execution.
+
+ See send_command for general case.
+
+ :return: status int, out std, err str
+ """
+
+ t1 = time.time()
+ result = CommandResult()
+ self.send_command(result, "mon", "", json.dumps(cmd_dict), "")
+ r = result.wait()
+ t2 = time.time()
+
+ self.log.debug("mon_command: '{0}' -> {1} in {2:.3f}s".format(
+ cmd_dict['prefix'], r[0], t2 - t1
+ ))
+
+ return r
+
def send_command(self, *args, **kwargs):
"""
Called by the plugin to send a command to the mon