Skip to content

Instantly share code, notes, and snippets.

@wido
Last active February 16, 2017 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wido/c999215a91a32a3945ac58c774d593f3 to your computer and use it in GitHub Desktop.
Save wido/c999215a91a32a3945ac58c774d593f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Simple Python script which creates a few RADOS connections and randomly uses them to perform
# stat calls on Objects
#
# Script was used to diagnose some problems a customer experienced with his Ceph cluster
#
# Author: Wido den Hollander <wido@widodh.nl>
#
import random
import rados
NUM_CONNS = 5
NUM_ITERATIONS = 1000
POOL = 'rbd'
OBJECT = 'foo'
def main():
connpool = list()
for i in range(NUM_CONNS):
cluster = rados.Rados(conffile='/etc/ceph/ceph.conf')
cluster.connect()
connpool.append(cluster)
for i in range(NUM_ITERATIONS):
conn = random.choice(connpool)
io = conn.open_ioctx(POOL)
size, mtime = io.stat(OBJECT)
io.read(OBJECT, size, 0)
io.close()
for conn in connpool:
conn.shutdown()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment