From: Patrick Donnelly Date: Tue, 5 Jan 2021 21:43:26 +0000 (-0800) Subject: qa: get pool holding file data from file layout X-Git-Tag: v16.1.0~106^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d7cacef125be9a332e9f6737f6c3f0ee00baf615;p=ceph.git qa: get pool holding file data from file layout Otherwise it always looks at the default data pool. For ec pools, this may not be where the file data is. Fixes: https://tracker.ceph.com/issues/48756 Signed-off-by: Patrick Donnelly --- diff --git a/qa/workunits/fs/misc/direct_io.py b/qa/workunits/fs/misc/direct_io.py index 3419659630c5..f7d59d95a2bf 100755 --- a/qa/workunits/fs/misc/direct_io.py +++ b/qa/workunits/fs/misc/direct_io.py @@ -1,24 +1,16 @@ #!/usr/bin/python3 -import json import mmap import os import subprocess - -def get_data_pool(): - cmd = ['ceph', 'fs', 'ls', '--format=json-pretty'] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) - out = proc.communicate()[0] - return json.loads(out)[0]['data_pools'][0] - - def main(): - fd = os.open("testfile", os.O_RDWR | os.O_CREAT | os.O_TRUNC | os.O_DIRECT, 0o644) + path = "testfile" + fd = os.open(path, os.O_RDWR | os.O_CREAT | os.O_TRUNC | os.O_DIRECT, 0o644) ino = os.fstat(fd).st_ino obj_name = "{ino:x}.00000000".format(ino=ino) - pool_name = get_data_pool() + pool_name = os.getxattr(path, "ceph.file.layout.pool") buf = mmap.mmap(-1, 1) buf.write(b'1')