]>
Commit | Line | Data |
---|---|---|
9f95a23c | 1 | #!/usr/bin/env python3 |
7c673cae FG |
2 | """ |
3 | Loop writing/reading the first 4k of image argv[1] in pool rbd, | |
4 | after acquiring exclusive lock named argv[2]. When an exception | |
5 | happens, split off the last number in the exception 'args' string | |
6 | and use it as the process exit code, if it's convertible to a number. | |
7 | ||
f67539c2 | 8 | Designed to run against a blocklist operation and verify the |
7c673cae FG |
9 | ESHUTDOWN expected from the image operation. |
10 | ||
11 | Note: this cannot be run with writeback caching on, currently, as | |
12 | writeback errors cause reads be marked dirty rather than error, and | |
13 | even if they were marked as errored, ObjectCacher would retry them | |
14 | rather than note them as errored. | |
15 | """ | |
16 | ||
17 | import rados, rbd, sys | |
18 | ||
19 | with rados.Rados(conffile='') as r: | |
20 | with r.open_ioctx('rbd') as ioctx: | |
21 | try: | |
22 | with rbd.Image(ioctx, sys.argv[1]) as image: | |
23 | image.lock_exclusive(sys.argv[2]) | |
24 | while True: | |
25 | image.write(b'A' * 4096, 0) | |
26 | r = image.read(0, 4096) | |
27 | except rbd.ConnectionShutdown: | |
28 | # it so happens that the errno here is 108, but | |
29 | # anything recognizable would do | |
30 | exit(108) |