]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
task/watch_notify_stress.py: add simple watch_notify stress test
authorSamuel Just <samuel.just@dreamhost.com>
Thu, 22 Sep 2011 20:23:05 +0000 (13:23 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Thu, 22 Sep 2011 20:25:21 +0000 (13:25 -0700)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
teuthology/task/watch_notify_stress.py [new file with mode: 0644]

diff --git a/teuthology/task/watch_notify_stress.py b/teuthology/task/watch_notify_stress.py
new file mode 100644 (file)
index 0000000..cd76404
--- /dev/null
@@ -0,0 +1,80 @@
+import contextlib
+import logging
+
+from ..orchestra import run
+
+log = logging.getLogger(__name__)
+
+@contextlib.contextmanager
+def task(ctx, config):
+    """
+    Run test_stress_watch
+
+    The config should be as follows:
+
+    test_stress_watch:
+        clients: [client list]
+
+    example:
+
+    tasks:
+    - ceph:
+    - test_stress_watch:
+        clients: [client.0]
+    - interactive:
+    """
+    log.info('Beginning test_stress_watch...')
+    assert isinstance(config, dict), \
+        "please list clients to run on"
+    testsnaps = {}
+
+    (mon,) = ctx.cluster.only('mon.0').remotes.iterkeys()
+    remotes = []
+    for role in config.get('clients', ['client.0']):
+        assert isinstance(role, basestring)
+        PREFIX = 'client.'
+        assert role.startswith(PREFIX)
+        id_ = role[len(PREFIX):]
+        (remote,) = ctx.cluster.only(role).remotes.iterkeys()
+        remotes.append(remote)
+
+        remote.run(
+            args=[
+                'cp',
+                '/tmp/cephtest/ceph.conf',
+                '/tmp/cephtest/data/ceph.conf',
+                ],
+            logger=log.getChild('test_stress_watch.{id}'.format(id=id_)),
+            wait=True,
+            )
+
+        proc = remote.run(
+            args=[
+                '/bin/sh', '-c',
+                " ".join([
+                    'cd', '/tmp/cephtest/data;',
+                    'export CEPH_CLIENT_ID={id_}; export CEPH_CONF=ceph.conf; LD_PRELOAD=/tmp/cephtest/binary/usr/local/lib/librados.so.2 /tmp/cephtest/binary/usr/local/bin/test_stress_watch'.format(
+                        id_=id_),
+                    ])
+                ],
+            logger=log.getChild('testsnaps.{id}'.format(id=id_)),
+            stdin=run.PIPE,
+            wait=False
+            )
+        testsnaps[id_] = proc
+
+    try:
+        yield
+    finally:
+        for i in remotes:
+            i.run(
+                args=[
+                    'rm',
+                    '/tmp/cephtest/data/ceph.conf'
+                    ],
+                logger=log.getChild('testsnaps.{id}'.format(id=id_)),
+                wait=True,
+                )
+
+        log.info('joining watch_notify_stress')
+        run.wait(testsnaps.itervalues())