Last active
February 16, 2017 21:03
-
-
Save wido/c999215a91a32a3945ac58c774d593f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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