From c5f070b8a9e0da0c86f46cb014d5fb043eb55497 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 10 Nov 2011 21:35:11 -0800 Subject: [PATCH] filestore_idempotent.py: simple task to test non-idempotent osd ops 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 --- teuthology/task/filestore_idempotent.py | 50 +++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 teuthology/task/filestore_idempotent.py diff --git a/teuthology/task/filestore_idempotent.py b/teuthology/task/filestore_idempotent.py new file mode 100644 index 0000000000000..0ad9bada9aa8e --- /dev/null +++ b/teuthology/task/filestore_idempotent.py @@ -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 + ]) + -- 2.39.5