From f1e521a43ba25ea1a764c2f012aebef5c8e0432d Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 29 Aug 2019 17:44:14 +0530 Subject: [PATCH] qa/mount.py: allow setting mountpoint Add setter method so that mountpoint for CephFSMount object can be set later. Signed-off-by: Rishabh Dave --- qa/tasks/cephfs/mount.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index 557b50a661d43..23106aa5e6db1 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -26,6 +26,7 @@ class CephFSMount(object): self.client_id = client_id self.client_remote = client_remote self.mountpoint_dir_name = 'mnt.{id}'.format(id=self.client_id) + self._mountpoint = None self.fs = None self.test_files = ['a', 'b', 'c'] @@ -34,8 +35,16 @@ class CephFSMount(object): @property def mountpoint(self): - return os.path.join( - self.test_dir, '{dir_name}'.format(dir_name=self.mountpoint_dir_name)) + if self._mountpoint == None: + self._mountpoint= os.path.join( + self.test_dir, '{dir_name}'.format(dir_name=self.mountpoint_dir_name)) + return self._mountpoint + + @mountpoint.setter + def mountpoint(self, path): + if not isinstance(path, str): + raise RuntimeError('path should be of str type.') + self._mountpoint = path def is_mounted(self): raise NotImplementedError() -- 2.39.5