]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "luminous: pybind/mgr/mgr_module: make rados handle available to all modules" 23345/head
authorErnesto Puerta <37327689+epuertat@users.noreply.github.com>
Tue, 31 Jul 2018 09:39:53 +0000 (11:39 +0200)
committerErnesto Puerta <epuertat@redhat.com>
Tue, 31 Jul 2018 10:13:09 +0000 (12:13 +0200)
Reverts: https://github.com/ceph/ceph/pull/23235
Reverts: 45c7170eb68571a3d690460f99392c6753994799

Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
src/pybind/mgr/dashboard/module.py
src/pybind/mgr/mgr_module.py

index b993c54b0015cf0bcd92a899d164d0a9dd177557..3d5e3191aa654415cce5684e5e0fa0227d63e1a9 100644 (file)
@@ -33,6 +33,7 @@ from mgr_module import MgrModule, MgrStandbyModule, CommandResult
 from types import OsdMap, NotFound, Config, FsMap, MonMap, \
     PgSummary, Health, MonStatus
 
+import rados
 import rbd_iscsi
 import rbd_mirroring
 from rbd_ls import RbdLs, RbdPoolLs
@@ -131,6 +132,9 @@ class Module(MgrModule):
         self.log_buffer = collections.deque(maxlen=LOG_BUFFER_SIZE)
         self.audit_buffer = collections.deque(maxlen=LOG_BUFFER_SIZE)
 
+        # Keep a librados instance for those that need it.
+        self._rados = None
+
         # Stateful instances of RbdLs, hold cached results.  Key to dict
         # is pool name.
         self.rbd_ls = {}
@@ -156,6 +160,21 @@ class Module(MgrModule):
         # A prefix for all URLs to use the dashboard with a reverse http proxy
         self.url_prefix = ''
 
+    @property
+    def rados(self):
+        """
+        A librados instance to be shared by any classes within
+        this mgr module that want one.
+        """
+        if self._rados:
+            return self._rados
+
+        ctx_capsule = self.get_context()
+        self._rados = rados.Rados(context=ctx_capsule)
+        self._rados.connect()
+
+        return self._rados
+
     def update_pool_stats(self):
         df = global_instance().get("df")
         pool_stats = dict([(p['id'], p['stats']) for p in df['pools']])
@@ -230,6 +249,10 @@ class Module(MgrModule):
         cherrypy.engine.exit()
         log.info("Stopped server")
 
+        log.info("Stopping librados...")
+        if self._rados:
+            self._rados.shutdown()
+        log.info("Stopped librados.")
 
     def get_latest(self, daemon_type, daemon_name, stat):
         data = self.get_counter(daemon_type, daemon_name, stat)[stat]
index c4049a30c8e557434be92584509f779febe68397..230d6f20b928d3d7ad9a86e45994af5f214480a7 100644 (file)
@@ -8,7 +8,6 @@ import json
 import logging
 import threading
 from collections import defaultdict
-import rados
 
 
 class CPlusPlusHandler(logging.Handler):
@@ -238,9 +237,6 @@ class MgrModule(ceph_module.BaseMgrModule):
 
         self._perf_schema_cache = None
 
-        # Keep a librados instance for those that need it.
-        self._rados = None
-
     def __del__(self):
         unconfigure_logger(self, self.module_name)
 
@@ -294,8 +290,7 @@ class MgrModule(ceph_module.BaseMgrModule):
 
         :return: None
         """
-        if self._rados:
-            self._rados.shutdown()
+        pass
 
     def get(self, data_name):
         """
@@ -633,19 +628,3 @@ class MgrModule(ceph_module.BaseMgrModule):
         """
 
         return self._ceph_have_mon_connection()
-
-    @property
-    def rados(self):
-        """
-        A librados instance to be shared by any classes within
-        this mgr module that want one.
-        """
-        if self._rados:
-            return self._rados
-
-        ctx_capsule = self.get_context()
-        self._rados = rados.Rados(context=ctx_capsule)
-        self._rados.connect()
-
-        return self._rados
-