Merge pull request #39690 from rishabh-d-dave/qa-raw_cluster_cmd

qa/ceph_manger: fixes bugs in CephManager

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Kefu Chai 2021-03-07 23:51:05 +08:00 committed by GitHub
commit 3cdb88b0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -1419,15 +1419,18 @@ class CephManager:
"""
Start ceph on a raw cluster. Return count
"""
stdout = kwargs.pop('stdout', StringIO())
p = self.run_cluster_cmd(args=args, stdout=stdout, **kwargs)
return p.stdout.getvalue()
if kwargs.get('args') is None and args:
kwargs['args'] = args
kwargs['stdout'] = kwargs.pop('stdout', StringIO())
return self.run_cluster_cmd(**kwargs).stdout.getvalue()
def raw_cluster_cmd_result(self, *args, **kwargs):
"""
Start ceph on a cluster. Return success or failure information.
"""
kwargs['args'], kwargs['check_status'] = args, False
if kwargs.get('args') is None and args:
kwargs['args'] = args
kwargs['check_status'] = False
return self.run_cluster_cmd(**kwargs).exitstatus
def run_ceph_w(self, watch_channel=None):

View File

@ -990,16 +990,18 @@ class LocalCephManager(CephManager):
args like ["osd", "dump"}
return stdout string
"""
kwargs['args'] = args
if kwargs.get('stdout') is None:
kwargs['stdout'] = StringIO()
if kwargs.get('args') is None and args:
kwargs['args'] = args
kwargs['stdout'] = kwargs.pop('stdout', StringIO())
return self.run_cluster_cmd(**kwargs).stdout.getvalue()
def raw_cluster_cmd_result(self, *args, **kwargs):
"""
like raw_cluster_cmd but don't check status, just return rc
"""
kwargs['args'], kwargs['check_status'] = args, False
if kwargs.get('args') is None and args:
kwargs['args'] = args
kwargs['check_status'] = False
return self.run_cluster_cmd(**kwargs).exitstatus
def admin_socket(self, daemon_type, daemon_id, command, check_status=True,