]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: get pool holding file data from file layout 38776/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 5 Jan 2021 21:43:26 +0000 (13:43 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 6 Jan 2021 15:11:20 +0000 (07:11 -0800)
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 <pdonnell@redhat.com>
qa/workunits/fs/misc/direct_io.py

index 3419659630c5d389a966c8b41086e6c133dfde7d..f7d59d95a2bffa752026179f1e5eeb323e66c809 100755 (executable)
@@ -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')