]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore_idempotent.py: simple task to test non-idempotent osd ops
authorSage Weil <sage@newdream.net>
Fri, 11 Nov 2011 05:35:11 +0000 (21:35 -0800)
committerSage Weil <sage@newdream.net>
Fri, 11 Nov 2011 05:35:11 +0000 (21:35 -0800)
Write some non-idempotent events to the osd.  Simulate a failure.  Verify
the result is correct on replay.

This must be preceeded by the ceph task just so that we get the binaries
installed.  Should clean this up later if/when the installation gets
factored out of ceph.py.

Signed-off-by: Sage Weil <sage@newdream.net>
teuthology/task/filestore_idempotent.py [new file with mode: 0644]

diff --git a/teuthology/task/filestore_idempotent.py b/teuthology/task/filestore_idempotent.py
new file mode 100644 (file)
index 0000000..0ad9bad
--- /dev/null
@@ -0,0 +1,50 @@
+from cStringIO import StringIO
+import logging
+
+from teuthology import misc as teuthology
+
+log = logging.getLogger(__name__)
+
+def task(ctx, config):
+    """
+    Test filestore/filejournal handling of non-idempotent events.
+
+    Currently this is a kludge; we require the ceph task preceeds us just
+    so that we get the tarball installed to run the test binary.
+    """
+    assert config is None or isinstance(config, list) \
+        or isinstance(config, dict), \
+        "task only supports a list or dictionary for configuration"
+    all_clients = ['client.{id}'.format(id=id_)
+                   for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
+    if config is None:
+        config = all_clients
+    if isinstance(config, list):
+        config = dict.fromkeys(config)
+    clients = config.keys()
+
+    # just use the first client...
+    client = clients[0];
+    (remote,) = ctx.cluster.only(client).remotes.iterkeys()
+
+    dir = '/tmp/cephtest/data/test.%s' % client
+    journal = '/tmp/cephtest/data/test.journal.%s' % client
+
+    remote.run(args=['mkdir', dir])
+    remote.run(args=['dd', 'if=/dev/zero', 'of=%s' % journal, 'bs=1M',
+                     'count=100'])
+
+    log.info('writing some data and simulating a failure')
+    remote.run(args=[
+            '/tmp/cephtest/binary/usr/local/bin/test_filestore_idempotent',
+            '-c', '/tmp/cephtest/ceph.conf',
+            'write', dir, journal
+            ])
+
+    log.info('verifying journal replay gives the correct result')
+    remote.run(args=[
+            '/tmp/cephtest/binary/usr/local/bin/test_filestore_idempotent',
+            '-c', '/tmp/cephtest/ceph.conf',
+            'verify', dir, journal
+            ])
+