From 8620c4caf55d3ee6424a8f83ab3f3934a705be5f Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 17 Jul 2018 09:51:07 -0700 Subject: [PATCH] vstart_runner: pass ctx to FuseMount and load mount info Credit to Venky for finding the problem. Signed-off-by: Patrick Donnelly --- qa/tasks/cephfs/fuse_mount.py | 3 +++ qa/tasks/vstart_runner.py | 30 +++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index af54b925079ae..3443ebcc41549 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -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: diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 87e45e0f840bc..99e9cbd6b6538 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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): -- 2.39.5