]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: use StringIO for capturing string output
authorKefu Chai <kchai@redhat.com>
Sun, 5 Apr 2020 10:35:42 +0000 (18:35 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:56:59 +0000 (19:56 +0800)
see d8d44ed1566b19eec055e07da2a0fed88fed4152

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 8bfe977854686149c74de3ebaed7b571d43404dd)

Conflicts:
qa/tasks/ceph_manager.py
qa/tasks/cephadm.py: trivial resolutions

qa/tasks/ceph_manager.py
qa/tasks/watch_notify_same_primary.py

index 0809996fca200c28b6e1fb860645e0800dbe8606..6b1a89be35bec0f68a6fb965f31efff7adaa2b4c 100644 (file)
@@ -15,6 +15,7 @@ import traceback
 import os
 
 from io import BytesIO
+from six import StringIO
 from teuthology import misc as teuthology
 from tasks.scrub import Scrubber
 from tasks.util.rados import cmd_erasure_code_profile
@@ -1201,7 +1202,7 @@ class CephManager:
         if watch_channel is not None:
             args.append("--watch-channel")
             args.append(watch_channel)
-        return self.controller.run(args=args, wait=False, stdout=BytesIO(), stdin=run.PIPE)
+        return self.controller.run(args=args, wait=False, stdout=StringIO(), stdin=run.PIPE)
 
     def flush_pg_stats(self, osds, no_wait=None, wait_for_mon=300):
         """
@@ -1337,7 +1338,7 @@ class CephManager:
 
     def osd_admin_socket(self, osd_id, command, check_status=True, timeout=0, stdout=None):
         if stdout is None:
-            stdout = BytesIO()
+            stdout = StringIO()
         return self.admin_socket('osd', osd_id, command, check_status, timeout, stdout)
 
     def find_remote(self, service_type, service_id):
@@ -1361,7 +1362,7 @@ class CephManager:
                         to the admin socket
         """
         if stdout is None:
-            stdout = BytesIO()
+            stdout = StringIO()
         testdir = teuthology.get_testdir(self.ctx)
         remote = self.find_remote(service_type, service_id)
         args = [
@@ -1477,7 +1478,7 @@ class CephManager:
         five seconds and try again.
         """
         if stdout is None:
-            stdout = BytesIO()
+            stdout = StringIO()
         tries = 0
         while True:
             proc = self.admin_socket(service_type, service_id,
index 7160979119b38ff0c640d5caee33ed04b0cf4f32..7c034961c3824f6abc378f539ea2e7b2f5976203 100644 (file)
@@ -2,7 +2,7 @@
 """
 watch_notify_same_primary task
 """
-from io import BytesIO
+from six import StringIO
 import contextlib
 import logging
 
@@ -68,8 +68,8 @@ def task(ctx, config):
                 "watch",
                 obj(n)],
             stdin=run.PIPE,
-            stdout=BytesIO(),
-            stderr=BytesIO(),
+            stdout=StringIO(),
+            stderr=StringIO(),
             wait=False)
         return proc