]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: remove get_lone_mds_id
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 11 Mar 2021 18:31:05 +0000 (10:31 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 31 Mar 2021 14:29:54 +0000 (07:29 -0700)
This helps remove a dependence on the list of mds_daemons from
teuthology/cephadm.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 8e45af05c9933312f5b739b79e87fa2cf33a043a)

qa/tasks/cephfs/filesystem.py
qa/tasks/cephfs/test_admin.py
qa/tasks/cephfs/test_misc.py

index 3c07a99edcf0950c27f05b3ca6b25dc35723a3c1..cd60e6ebef4ad0716ebdec9cdfcaaacd39d60d7a 100644 (file)
@@ -1036,21 +1036,6 @@ class Filesystem(MDSCluster):
 
             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
@@ -1113,13 +1098,13 @@ class Filesystem(MDSCluster):
 
     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))
 
index 408744ae63b047be6dd9074f68f6fc057512b300..c10b9a482e02d5897242c80f168f10562d04eb9d 100644 (file)
@@ -314,12 +314,10 @@ class TestConfigCommands(CephFSTestCase):
         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)
 
 
index b8740136067aa84d817f22dea4dcad20bc4edeb2..a0169bef8f4ec653c58bc02f5e3c02a9f54f7680 100644 (file)
@@ -204,14 +204,11 @@ class TestCacheDrop(CephFSTestCase):
 
     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