From: John Spray Date: Thu, 10 Nov 2016 22:46:23 +0000 (+0000) Subject: tasks/cephfs: reinstate ctx.filesystem X-Git-Tag: v11.1.1~58^2^2~13^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=797a4e776528f14237e90e4f972f3c262b043580;p=ceph.git tasks/cephfs: reinstate ctx.filesystem This got lost in the multi-filesystem refactor. It's just a debug convenience. Signed-off-by: John Spray --- diff --git a/tasks/cephfs/filesystem.py b/tasks/cephfs/filesystem.py index 6b73ed4f2f4..43b559f0bc8 100644 --- a/tasks/cephfs/filesystem.py +++ b/tasks/cephfs/filesystem.py @@ -377,6 +377,12 @@ class Filesystem(MDSCluster): self.id = fscid self.getinfo(refresh = True) + # Stash a reference to the first created filesystem on ctx, so + # that if someone drops to the interactive shell they can easily + # poke our methods. + if not hasattr(self._ctx, "filesystem"): + self._ctx.filesystem = self + def getinfo(self, refresh = False): status = self.status() if self.id is not None: @@ -437,6 +443,10 @@ class Filesystem(MDSCluster): self.getinfo(refresh = True) + def __del__(self): + if getattr(self._ctx, "filesystem", None) == self: + delattr(self._ctx, "filesystem") + def exists(self): """ Whether a filesystem exists in the mon's filesystem list diff --git a/tasks/vstart_runner.py b/tasks/vstart_runner.py index 2dd3a3bf929..c17dc14a91e 100644 --- a/tasks/vstart_runner.py +++ b/tasks/vstart_runner.py @@ -708,6 +708,12 @@ class LocalFilesystem(Filesystem, LocalMDSCluster): self.id = fscid self.getinfo(refresh=True) + # Stash a reference to the first created filesystem on ctx, so + # that if someone drops to the interactive shell they can easily + # poke our methods. + if not hasattr(self._ctx, "filesystem"): + self._ctx.filesystem = self + @property def _prefix(self): return BIN_PREFIX