From: John Spray Date: Mon, 22 Sep 2014 09:40:19 +0000 (+0100) Subject: pybind/ceph_argparse: implement 'tell mds' X-Git-Tag: v0.88~97^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92178bc01544cb17b605fc0956caa2ca26ec7a2f;p=ceph.git pybind/ceph_argparse: implement 'tell mds' Signed-off-by: John Spray --- diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index 9873061c8589..59f18af9d453 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -1061,6 +1061,25 @@ def send_command(cluster, target=('mon', ''), cmd=None, inbuf='', timeout=0, ret, outbuf, outs = cluster.mon_command(cmd, inbuf, timeout) else: ret, outbuf, outs = cluster.mon_command(cmd, inbuf, timeout, target[1]) + elif target[0] == 'mds': + mds_spec = target[1] + + if verbose: + print >> sys.stderr, 'submit {0} to mds.{1}'.\ + format(cmd, mds_spec) + + try: + from cephfs import LibCephFS + except ImportError: + raise RuntimeError("CephFS unavailable, have you installed libcephfs?") + + filesystem = LibCephFS(cluster.conf_defaults, cluster.conffile) + filesystem.conf_parse_argv(cluster.parsed_args) + + filesystem.init() + ret, outbuf, outs = \ + filesystem.mds_command(mds_spec, cmd, inbuf) + filesystem.shutdown() else: raise ArgumentValid("Bad target type '{0}'".format(target[0])) @@ -1109,7 +1128,7 @@ def json_command(cluster, target=('mon', ''), prefix=None, argdict=None, except Exception as e: if not isinstance(e, ArgumentError): - raise RuntimeError('"{0}": exception {1}'.format(cmd, e)) + raise RuntimeError('"{0}": exception {1}'.format(argdict, e)) else: raise