From: Kefu Chai Date: Sun, 5 Apr 2020 13:16:10 +0000 (+0800) Subject: qa/tasks/cephfs: use BytesIO for capturing binary X-Git-Tag: v14.2.10~17^2~69 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2924cc811a4af1bd51bc161109dc96bd563ce00a;p=ceph.git 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 (cherry picked from commit eb2c6b3740cee7c8e28c163f73525cbabf2e7faf) --- diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 87396f353227..943ae175eae8 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 @@ -1062,11 +1064,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,