]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
vstart_runner: pass ctx to FuseMount and load mount info 23097/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 17 Jul 2018 16:51:07 +0000 (09:51 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 18 Jul 2018 13:42:16 +0000 (06:42 -0700)
Credit to Venky for finding the problem.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/tasks/cephfs/fuse_mount.py
qa/tasks/vstart_runner.py

index af54b925079ae0176c436092bc77b5c23c512fdc..3443ebcc4154981db8dd2c03adcb0a98185d356d 100644 (file)
@@ -158,6 +158,9 @@ class FuseMount(CephFSMount):
         else:
             self._fuse_conn = new_conns[0]
 
+        self.gather_mount_info()
+
+    def gather_mount_info(self):
         status = self.admin_socket(['status'])
         self.id = status['id']
         try:
index 87e45e0f840bc75b225930ea2fbb9907d585eac8..99e9cbd6b6538a0bae2400814cc4c6cb248f91d9 100644 (file)
@@ -389,8 +389,8 @@ def safe_kill(pid):
 
 
 class LocalFuseMount(FuseMount):
-    def __init__(self, test_dir, client_id):
-        super(LocalFuseMount, self).__init__(None, test_dir, client_id, LocalRemote())
+    def __init__(self, ctx, test_dir, client_id):
+        super(LocalFuseMount, self).__init__(ctx, None, test_dir, client_id, LocalRemote())
 
     @property
     def config_path(self):
@@ -409,6 +409,15 @@ class LocalFuseMount(FuseMount):
             args, wait=wait, cwd=self.mountpoint
         )
 
+    def setupfs(self, name=None):
+        if name is None and self.fs is not None:
+            # Previous mount existed, reuse the old name
+            name = self.fs.name
+        self.fs = LocalFilesystem(self.ctx, name=name)
+        log.info('Wait for MDS to reach steady state...')
+        self.fs.wait_for_daemons()
+        log.info('Ready to start {}...'.format(type(self).__name__))
+
     @property
     def _prefix(self):
         return BIN_PREFIX
@@ -439,6 +448,8 @@ class LocalFuseMount(FuseMount):
             super(LocalFuseMount, self).umount()
 
     def mount(self, mount_path=None, mount_fs_name=None):
+        self.setupfs(name=mount_fs_name)
+
         self.client_remote.run(
             args=[
                 'mkdir',
@@ -519,6 +530,8 @@ class LocalFuseMount(FuseMount):
         else:
             self._fuse_conn = new_conns[0]
 
+        self.gather_mount_info()
+
     def _run_python(self, pyscript):
         """
         Override this to remove the daemon-helper prefix that is used otherwise
@@ -829,7 +842,6 @@ class LocalContext(object):
     def __del__(self):
         shutil.rmtree(self.teuthology_config['test_path'])
 
-
 def exec_test():
     # Parse arguments
     interactive_on_error = False
@@ -897,6 +909,11 @@ def exec_test():
     test_dir = tempfile.mkdtemp()
     teuth_config['test_path'] = test_dir
 
+    ctx = LocalContext()
+    ceph_cluster = LocalCephCluster(ctx)
+    mds_cluster = LocalMDSCluster(ctx)
+    mgr_cluster = LocalMgrCluster(ctx)
+
     # Construct Mount classes
     mounts = []
     for client_id in clients:
@@ -912,7 +929,7 @@ def exec_test():
 
             open("./keyring", "a").write(p.stdout.getvalue())
 
-        mount = LocalFuseMount(test_dir, client_id)
+        mount = LocalFuseMount(ctx, test_dir, client_id)
         mounts.append(mount)
         if mount.is_mounted():
             log.warn("unmounting {0}".format(mount.mountpoint))
@@ -921,11 +938,6 @@ def exec_test():
             if os.path.exists(mount.mountpoint):
                 os.rmdir(mount.mountpoint)
 
-    ctx = LocalContext()
-    ceph_cluster = LocalCephCluster(ctx)
-    mds_cluster = LocalMDSCluster(ctx)
-    mgr_cluster = LocalMgrCluster(ctx)
-
     from tasks.cephfs_test_runner import DecoratingLoader
 
     class LogStream(object):