]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/ceph_argparse: implement 'tell mds'
authorJohn Spray <john.spray@redhat.com>
Mon, 22 Sep 2014 09:40:19 +0000 (10:40 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 8 Oct 2014 10:58:19 +0000 (11:58 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/ceph_argparse.py

index 9873061c8589afbaccf0bd551f50811a9340e3e0..59f18af9d4532b7babf35e75b7f618ecbd8e7957 100644 (file)
@@ -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