From a1e7927c53231c63d517a5530784447e90b5818a Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Wed, 4 Mar 2020 20:59:04 -0500 Subject: [PATCH] qa/tasks/vstart_runner: use parent's umount methods Signed-off-by: Xiubo Li (cherry picked from commit 95820bf48f24579a099a2acf02575cddb3295c4a) --- qa/tasks/cephfs/fuse_mount.py | 3 +++ qa/tasks/cephfs/kernel_mount.py | 3 +++ qa/tasks/vstart_runner.py | 31 ------------------------------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/qa/tasks/cephfs/fuse_mount.py b/qa/tasks/cephfs/fuse_mount.py index 21a9a6d2f16b8..6ca08a460b816 100644 --- a/qa/tasks/cephfs/fuse_mount.py +++ b/qa/tasks/cephfs/fuse_mount.py @@ -244,6 +244,9 @@ class FuseMount(CephFSMount): return self.client_remote.run(args=["ls", "-d", self.mountpoint], check_status=False, cwd=self.test_dir, timeout=(15*60)).exitstatus == 0 def umount(self): + if not self.is_mounted(): + return + try: log.info('Running fusermount -u on {name}...'.format(name=self.client_remote.name)) self.client_remote.run( diff --git a/qa/tasks/cephfs/kernel_mount.py b/qa/tasks/cephfs/kernel_mount.py index 86a06006df752..8e4eeb66a96a3 100644 --- a/qa/tasks/cephfs/kernel_mount.py +++ b/qa/tasks/cephfs/kernel_mount.py @@ -74,6 +74,9 @@ class KernelMount(CephFSMount): self.mounted = True def umount(self, force=False): + if not self.is_mounted(): + return + log.debug('Unmounting client client.{id}...'.format(id=self.client_id)) cmd=['sudo', 'umount', self.mountpoint] diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 7055ebb7c9d8d..8b57fd540671b 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -615,33 +615,6 @@ class LocalKernelMount(KernelMount): log.info("I think my launching pid was {0}".format(self.fuse_daemon.subproc.pid)) return path - def umount(self, force=False): - log.debug('Unmounting client client.{id}...'.format(id=self.client_id)) - - cmd=['sudo', 'umount', self.mountpoint] - if force: - cmd.append('-f') - - try: - self.client_remote.run(args=cmd, timeout=(15*60), omit_sudo=False) - except Exception as e: - self.client_remote.run(args=[ - 'sudo', - Raw('PATH=/usr/sbin:$PATH'), - 'lsof', - Raw(';'), - 'ps', 'auxf', - ], timeout=(15*60), omit_sudo=False) - raise e - - rproc = self.client_remote.run(args=[ - 'rmdir', - '--', - self.mountpoint, - ]) - rproc.wait() - self.mounted = False - def mount(self, mount_path=None, mount_fs_name=None, mount_options=[]): self.setupfs(name=mount_fs_name) @@ -803,10 +776,6 @@ class LocalFuseMount(FuseMount): log.info("I think my launching pid was {0}".format(self.fuse_daemon.subproc.pid)) return path - def umount(self): - if self.is_mounted(): - super(LocalFuseMount, self).umount() - def mount(self, mount_path=None, mount_fs_name=None, mountpoint=None, mount_options=[]): if mountpoint is not None: self.mountpoint = mountpoint -- 2.39.5