From eb2c6b3740cee7c8e28c163f73525cbabf2e7faf Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 5 Apr 2020 21:16:10 +0800 Subject: [PATCH] qa/tasks/cephfs: use BytesIO for capturing binary this change partially reverts e46eb8348e0639ea162b7e224bca40e0257ad6ef. xattrs could contain non-utf8 encoded data, and should be captured using BytesIO. moreover, it will be fed to `ceph-dencoder`, which expects binary when performing "import". Signed-off-by: Kefu Chai --- qa/tasks/cephfs/filesystem.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 18aa118eaebfc..dc811fe8d47e2 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -10,6 +10,8 @@ import errno import random import traceback +from io import BytesIO + from teuthology.exceptions import CommandFailedError from teuthology import misc from teuthology.nuke import clear_firewall @@ -1091,11 +1093,12 @@ class Filesystem(MDSCluster): os.path.join(self._prefix, "rados"), "-p", pool, "getxattr", obj_name, xattr_name ] try: - data = remote.sh(args) + proc = remote.run(args=args, stdout=BytesIO()) except CommandFailedError as e: log.error(e.__str__()) raise ObjectNotFound(obj_name) + data = proc.stdout.getvalue() dump = remote.sh( [os.path.join(self._prefix, "ceph-dencoder"), "type", type, -- 2.39.5