Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / pybind / mgr / dashboard / cephfs_clients.py
1
2 import json
3
4 from mgr_module import CommandResult
5 from remote_view_cache import RemoteViewCache
6
7
8 class CephFSClients(RemoteViewCache):
9     def __init__(self, module_inst, fscid):
10         super(CephFSClients, self).__init__(module_inst)
11
12         self.fscid = fscid
13
14     def _get(self):
15         mds_spec = "{0}:0".format(self.fscid)
16         result = CommandResult("")
17         self._module.send_command(result, "mds", mds_spec,
18                json.dumps({
19                    "prefix": "session ls",
20                    }),
21                "")
22         r, outb, outs = result.wait()
23         # TODO handle nonzero returns, e.g. when rank isn't active
24         assert r == 0
25         return json.loads(outb)