]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/rbd_fio: get rid of StringIO for py3
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Thu, 5 Mar 2020 22:40:47 +0000 (23:40 +0100)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Jun 2020 02:32:23 +0000 (10:32 +0800)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit db7ae8eff60a9e3cb26e4e5c736a9691cd3224e3)

qa/tasks/rbd_fio.py

index 2b520f53fc68bcbb91448fc01995784909b0e89c..82340b4d6fd2d3b15f7e9debf882472fb075b050 100644 (file)
@@ -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: