]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add ceph cmd helper
authorPatrick Donnelly <pdonnell@redhat.com>
Sun, 10 Jan 2021 20:59:57 +0000 (12:59 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 12 Jan 2021 15:24:28 +0000 (07:24 -0800)
A more programmer friendly command to use.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/ceph_manager.py

index 1fc11971f0f310dbb99f4f9bada58aa164094f5f..9d9e735091e64cddcd9580fa045ec8b6f25bddc1 100644 (file)
@@ -13,6 +13,7 @@ import logging
 import threading
 import traceback
 import os
+import shlex
 
 from io import BytesIO, StringIO
 from subprocess import DEVNULL
@@ -1326,6 +1327,17 @@ class CephManager:
             except CommandFailedError:
                 self.log('Failed to get pg_num from pool %s, ignoring' % pool)
 
+    def ceph(self, cmd, **kwargs):
+        """
+        Simple Ceph admin command wrapper around run_cluster_cmd.
+        """
+
+        kwargs.pop('args', None)
+        args = shlex.split(cmd)
+        stdout = kwargs.pop('stdout', StringIO())
+        stderr = kwargs.pop('stderr', StringIO())
+        return self.run_cluster_cmd(args=args, stdout=stdout, stderr=stderr, **kwargs)
+
     def run_cluster_cmd(self, **kwargs):
         """
         Run a Ceph command and return the object representing the process