From 9ef3937c6a021a94bd8847ee5838a969a231902c Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 5 Mar 2020 23:40:47 +0100 Subject: [PATCH] qa/tasks/rbd_fio: get rid of StringIO for py3 Signed-off-by: Kyr Shatskyy (cherry picked from commit db7ae8eff60a9e3cb26e4e5c736a9691cd3224e3) --- qa/tasks/rbd_fio.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/qa/tasks/rbd_fio.py b/qa/tasks/rbd_fio.py index 6b9d061be2a4b..79d33170ee07b 100644 --- a/qa/tasks/rbd_fio.py +++ b/qa/tasks/rbd_fio.py @@ -9,7 +9,6 @@ import contextlib import json import logging import os -import StringIO from teuthology.parallel import parallel from teuthology import misc as teuthology @@ -77,10 +76,8 @@ def get_ioengine_package_name(ioengine, remote): def run_rbd_map(remote, image, iodepth): iodepth = max(iodepth, 128) # RBD_QUEUE_DEPTH_DEFAULT - out = StringIO.StringIO() - remote.run(args=['sudo', 'rbd', 'device', 'map', '-o', - 'queue_depth={}'.format(iodepth), image], stdout=out) - dev = out.getvalue().rstrip('\n') + dev = remote.sh(['sudo', 'rbd', 'device', 'map', '-o', + 'queue_depth={}'.format(iodepth), image]).rstripg('\n') teuthology.sudo_write_file( remote, '/sys/block/{}/queue/nr_requests'.format(os.path.basename(dev)), @@ -214,9 +211,8 @@ def run_fio(remote, config, rbd_test_dir): remote.run(args=['sudo', run.Raw('{tdir}/fio-fio-{v}/fio {f}'.format(tdir=rbd_test_dir,v=fio_version,f=fio_config.name))]) remote.run(args=['ceph', '-s']) finally: - out=StringIO.StringIO() - remote.run(args=['rbd', 'device', 'list', '--format=json'], stdout=out) - mapped_images = json.loads(out.getvalue()) + out = remote.sh('rbd device list --format=json') + mapped_images = json.loads(out) if mapped_images: log.info("Unmapping rbd images on {sn}".format(sn=sn)) for image in mapped_images: -- 2.39.5