]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/fs/misc/direct_io.py
9 fd
= os
.open(path
, os
.O_RDWR | os
.O_CREAT | os
.O_TRUNC | os
.O_DIRECT
, 0o644)
11 ino
= os
.fstat(fd
).st_ino
12 obj_name
= "{ino:x}.00000000".format(ino
=ino
)
13 pool_name
= os
.getxattr(path
, "ceph.file.layout.pool")
15 buf
= mmap
.mmap(-1, 1)
19 proc
= subprocess
.Popen(['rados', '-p', pool_name
, 'get', obj_name
, 'tmpfile'])
22 with
open('tmpfile', 'rb') as tmpf
:
25 raise RuntimeError("data were not written to object store directly")
27 with
open('tmpfile', 'wb') as tmpf
:
30 proc
= subprocess
.Popen(['rados', '-p', pool_name
, 'put', obj_name
, 'tmpfile'])
33 os
.lseek(fd
, 0, os
.SEEK_SET
)
36 raise RuntimeError("data were not directly read from object store")