]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: reinstate ctx.filesystem
authorJohn Spray <john.spray@redhat.com>
Thu, 10 Nov 2016 22:46:23 +0000 (22:46 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 17 Nov 2016 23:50:08 +0000 (23:50 +0000)
This got lost in the multi-filesystem
refactor.  It's just a debug convenience.

Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/filesystem.py
tasks/vstart_runner.py

index 6b73ed4f2f42794822310740599a7c234aae011e..43b559f0bc89cd8f12ca6f2b4334f7087aaca686 100644 (file)
@@ -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
index 2dd3a3bf92999ed08be0ea422f9720f89a426f8a..c17dc14a91eb5698da5c864746f4c538396808e8 100644 (file)
@@ -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