]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/fs/misc/direct_io.py
10 cmd
= ['ceph', 'fs', 'ls', '--format=json-pretty']
11 proc
= subprocess
.Popen(cmd
, stdout
=subprocess
.PIPE
)
12 out
= proc
.communicate()[0]
13 return json
.loads(out
)[0]['data_pools'][0]
17 fd
= os
.open("testfile", os
.O_RDWR | os
.O_CREAT | os
.O_TRUNC | os
.O_DIRECT
, 0o644)
19 ino
= os
.fstat(fd
).st_ino
20 obj_name
= "{ino:x}.00000000".format(ino
=ino
)
21 pool_name
= get_data_pool()
23 buf
= mmap
.mmap(-1, 1)
27 proc
= subprocess
.Popen(['rados', '-p', pool_name
, 'get', obj_name
, 'tmpfile'])
30 with
open('tmpfile', 'rb') as tmpf
:
33 raise RuntimeError("data were not written to object store directly")
35 with
open('tmpfile', 'wb') as tmpf
:
38 proc
= subprocess
.Popen(['rados', '-p', pool_name
, 'put', obj_name
, 'tmpfile'])
41 os
.lseek(fd
, 0, os
.SEEK_SET
)
44 raise RuntimeError("data were not directly read from object store")