status = self.status()
- def get_lone_mds_id(self):
- """
- Get a single MDS ID: the only one if there is only one
- configured, else the only one currently holding a rank,
- else raise an error.
- """
- if len(self.mds_ids) != 1:
- alive = self.get_rank_names()
- if len(alive) == 1:
- return alive[0]
- else:
- raise ValueError("Explicit MDS argument required when multiple MDSs in use")
- else:
- return self.mds_ids[0]
-
def put_metadata_object_raw(self, object_id, infile):
"""
Save an object to the metadata pool
def mds_asok(self, command, mds_id=None, timeout=None):
if mds_id is None:
- mds_id = self.get_lone_mds_id()
+ return self.rank_asok(command, timeout=timeout)
return self.json_asok(command, 'mds', mds_id, timeout=timeout)
def mds_tell(self, command, mds_id=None):
if mds_id is None:
- mds_id = self.get_lone_mds_id()
+ return self.rank_tell(command)
return json.loads(self.mon_manager.raw_cluster_cmd("tell", f"mds.{mds_id}", *command))
test_key = "mds_max_purge_ops"
test_val = "123"
- mds_id = self.fs.get_lone_mds_id()
- self.fs.mon_manager.raw_cluster_cmd("tell", "mds.{0}".format(mds_id), "injectargs",
- "--{0}={1}".format(test_key, test_val))
+ self.fs.rank_tell(['injectargs', "--{0}={1}".format(test_key, test_val)])
# Read it back with asok because there is no `tell` equivalent
- out = self.fs.mds_asok(['config', 'get', test_key])
+ out = self.fs.rank_tell(['config', 'get', test_key])
self.assertEqual(out[test_key], test_val)
def _run_drop_cache_cmd(self, timeout=None):
result = None
- mds_id = self.fs.get_lone_mds_id()
+ args = ["cache", "drop"]
if timeout is not None:
- result = self.fs.mon_manager.raw_cluster_cmd("tell", "mds.{0}".format(mds_id),
- "cache", "drop", str(timeout))
- else:
- result = self.fs.mon_manager.raw_cluster_cmd("tell", "mds.{0}".format(mds_id),
- "cache", "drop")
- return json.loads(result)
+ args.append(str(timeout))
+ result = self.fs.rank_tell(args)
+ return result
def _setup(self, max_caps=20, threshold=400):
# create some files