]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/mds_journal_migration: use existing clients
authorJohn Spray <jspray@redhat.com>
Thu, 17 Jul 2014 20:35:22 +0000 (21:35 +0100)
committerJohn Spray <jspray@redhat.com>
Mon, 21 Jul 2014 11:56:05 +0000 (12:56 +0100)
Since refactoring ceph_fuse and kclient tasks
to store Mount objects on ctx, the mds_journal_migration
task can use those instead of explicitly instantiating its own.

Signed-off-by: John Spray <john.spray@redhat.com>
teuthology/task/cephfs/kernel_mount.py
teuthology/task/cephfs/mount.py
teuthology/task/mds_journal_migration.py

index 6e47bb45ca7ee8cd83522ca0f0f0743405a75b83..c319084697d089d7d11de077c19ebd2a71c12d12 100644 (file)
@@ -80,3 +80,19 @@ class KernelMount(CephFSMount):
                 mnt,
             ],
         )
+
+    def cleanup(self):
+        pass
+
+    def umount_wait(self):
+        pass
+
+    def is_mounted(self):
+        return True
+
+    def wait_until_mounted(self):
+        pass
+
+    def teardown(self):
+        super(KernelMount, self).teardown()
+        self.umount()
index bb8a6caa14805d1dd25fc3b1adb91c913d909451..42b943db37627c7fd964b12cd743e6222c62a428 100644 (file)
@@ -1,4 +1,4 @@
-
+from contextlib import contextmanager
 import logging
 import datetime
 from textwrap import dedent
@@ -47,6 +47,22 @@ class CephFSMount(object):
     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())
 
index 090c10d47b5b34b8e2964de4a081d873b7104274..53ee53e0cf0036b81ec93475c3cefa2ca14e46e8 100644 (file)
@@ -4,7 +4,6 @@ import logging
 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__)
@@ -28,6 +27,13 @@ def task(ctx, config):
         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']
@@ -43,17 +49,13 @@ def task(ctx, config):
             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
@@ -61,13 +63,15 @@ def task(ctx, config):
                      # 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
 
@@ -80,8 +84,7 @@ def task(ctx, config):
 
     # 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.
@@ -91,4 +94,10 @@ def task(ctx, config):
             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