-
+from contextlib import contextmanager
import logging
import datetime
from textwrap import dedent
def cleanup(self):
raise NotImplementedError()
+ def wait_until_mounted(self):
+ raise NotImplementedError()
+
+ @contextmanager
+ def mounted(self):
+ """
+ A context manager, from an initially unmounted state, to mount
+ this, yield, and then unmount and clean up.
+ """
+ self.mount()
+ self.wait_until_mounted()
+ try:
+ yield
+ finally:
+ self.umount_wait()
+
def create_files(self):
assert(self.is_mounted())
from teuthology import misc
from teuthology.task.ceph import write_conf
-from teuthology.task.ceph_fuse import task as ceph_fuse_ctx
from teuthology.task.cephfs.filesystem import Filesystem
log = logging.getLogger(__name__)
client: client.0
"""
+ if not hasattr(ctx, 'ceph'):
+ raise RuntimeError("This task must be nested in 'ceph' task")
+
+ if not hasattr(ctx, 'mounts'):
+ raise RuntimeError("This task must be nested inside 'kclient' or 'ceph_fuse' task")
+
+ # Determine which client we will use
if config and 'client' in config:
# Use client specified in config
client_role = config['client']
client_id = client_list[0]
except IndexError:
raise RuntimeError("This task requires at least one client")
- else:
- client_role = "client.{0}".format(client_id)
fs = Filesystem(ctx, config)
+ ctx.fs = fs
old_journal_version = JOURNAL_FORMAT_LEGACY
new_journal_version = JOURNAL_FORMAT_RESILIENT
# Set config so that journal will be created in older format
- if not hasattr(ctx, 'ceph'):
- raise RuntimeError("This task must be nested in 'ceph' task")
-
if 'mds' not in ctx.ceph.conf:
ctx.ceph.conf['mds'] = {}
ctx.ceph.conf['mds']['mds journal format'] = old_journal_version
# used a different config path this won't work.
# Create a filesystem using the older journal format.
+ for mount in ctx.mounts.values():
+ mount.umount_wait()
fs.mds_stop()
fs.reset()
fs.mds_restart()
# Do some client work so that the log is populated with something.
- with ceph_fuse_ctx(ctx, [client_role]) as client_mounts:
- mount = client_mounts[client_id]
+ mount = ctx.mounts[client_id]
+ with mount.mounted():
mount.create_files()
mount.check_files() # sanity, this should always pass
# Check that files created in the initial client workload are still visible
# in a client mount.
- with ceph_fuse_ctx(ctx, [client_role]) as client_mounts:
- mount = client_mounts[client_id]
+ with mount.mounted():
mount.check_files()
# Verify that the journal really has been rewritten.
new_journal_version, journal_version()
))
+ # Check that all MDS daemons are still up and running an in expected state
+
+ # Leave all MDSs and clients running for any child tasks
+ for mount in ctx.mounts.values():
+ mount.mount()
+
yield