From d7cacef125be9a332e9f6737f6c3f0ee00baf615 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 5 Jan 2021 13:43:26 -0800 Subject: [PATCH] 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 --- qa/workunits/fs/misc/direct_io.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/qa/workunits/fs/misc/direct_io.py b/qa/workunits/fs/misc/direct_io.py index 3419659630c5d..f7d59d95a2bff 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') -- 2.39.5