From a1dc6b6c1964423158dcd7c930db5e3063ff210e Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 24 Feb 2021 17:15:49 +0530 Subject: [PATCH] qa/ceph_manager: accepts commands as str too 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 --- qa/tasks/ceph_manager.py | 3 +++ qa/tasks/cephfs/cephfs_test_case.py | 2 +- qa/tasks/vstart_runner.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index f28565ef1cb..7e984788362 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -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']), diff --git a/qa/tasks/cephfs/cephfs_test_case.py b/qa/tasks/cephfs/cephfs_test_case.py index 49e7ad72086..42761d2e0bf 100644 --- a/qa/tasks/cephfs/cephfs_test_case.py +++ b/qa/tasks/cephfs/cephfs_test_case.py @@ -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", diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 6ee66214d2b..3769f447bed 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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) -- 2.39.5