qa: add ceph cmd helper

A more programmer friendly command to use.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2021-01-10 12:59:57 -08:00
parent c0907f99e8
commit 166bb4d551
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View 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