mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
c5f070b8a9
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>
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
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
|
|
])
|
|
|