]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/ceph_manager: accepts commands as str too
authorRishabh Dave <ridave@redhat.com>
Wed, 24 Feb 2021 11:45:49 +0000 (17:15 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 4 Mar 2021 04:12:44 +0000 (09:42 +0530)
Modify CephManager.run_cluster_cmd() to accept command arguments as
string as well since typing commands as strings is much lesser effort
than typing as list. This brings the interface a step closer to
teuthology.orchestra.remote.run()'s interface since it too can accept
commands arguments as string.

The change in cephfs_test_case.py is just to allow testing this PR
locally and on teuthology.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/ceph_manager.py
qa/tasks/cephfs/cephfs_test_case.py
qa/tasks/vstart_runner.py

index f28565ef1cbf37bb778214c2cd4e548e56f80893..7e98478836220148399b7f33151de2a642a8fe74 100644 (file)
@@ -1345,6 +1345,9 @@ class CephManager:
 
         Accepts arguments same as that of teuthology.orchestra.run.run()
         """
+        if isinstance(kwargs['args'], str):
+            kwargs['args'] = shlex.split(kwargs['args'])
+
         if self.cephadm:
             return shell(self.ctx, self.cluster, self.controller,
                          args=['ceph'] + list(kwargs['args']),
index 49e7ad720864ce9d9812a379acec09a771231696..42761d2e0bfcd8313c1be2667db56d872580ded7 100644 (file)
@@ -137,7 +137,7 @@ class CephFSTestCase(CephTestCase):
         # In case anything is in the OSD blocklist list, clear it out.  This is to avoid
         # the OSD map changing in the background (due to blocklist expiry) while tests run.
         try:
-            self.mds_cluster.mon_manager.raw_cluster_cmd("osd", "blocklist", "clear")
+            self.mds_cluster.mon_manager.run_cluster_cmd(args="osd blocklist clear")
         except CommandFailedError:
             # Fallback for older Ceph cluster
             blocklist = json.loads(self.mds_cluster.mon_manager.raw_cluster_cmd("osd",
index 6ee66214d2bc9ae1a22e1bef7b96dbb446ba4fd8..3769f447bedab00d966e871e6b2ed0c11d2ff662 100644 (file)
@@ -47,6 +47,7 @@ from IPy import IP
 import unittest
 import platform
 import logging
+import shlex
 
 from unittest import suite, loader
 
@@ -982,6 +983,8 @@ class LocalCephManager(CephManager):
 
         Accepts arguments same as teuthology.orchestra.remote.run().
         """
+        if isinstance(kwargs['args'], str):
+            kwargs['args'] = shlex.split(kwargs['args'])
         kwargs['args'] = [CEPH_CMD] + list(kwargs['args'])
         return self.controller.run(**kwargs)