Skip to content

Commit

Permalink
DEBUG: don't load librados at module import in dashboard
Browse files Browse the repository at this point in the history
Signed-off-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Jan 15, 2018
1 parent 04fe6b2 commit 387c981
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/pybind/mgr/dashboard/module.py
Expand Up @@ -32,9 +32,6 @@ def global_instance():
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
from cephfs_clients import CephFSClients
from rgw import RGWDaemons
Expand Down Expand Up @@ -125,6 +122,13 @@ def __init__(self, *args, **kwargs):
self.log_buffer = collections.deque(maxlen=LOG_BUFFER_SIZE)
self.audit_buffer = collections.deque(maxlen=LOG_BUFFER_SIZE)

# Import Ceph bindings at construction time rather than import time,
# for debugging weird lockdep crashes during import
# (https://github.com/ceph/ceph/pull/19235/files)
import rados
import rbd_iscsi
import rbd_mirroring

# Keep a librados instance for those that need it.
self._rados = None

Expand Down
8 changes: 6 additions & 2 deletions src/pybind/mgr/dashboard/rbd_ls.py
@@ -1,6 +1,4 @@

import rbd
import rados
from types import OsdMap
from remote_view_cache import RemoteViewCache

Expand All @@ -27,10 +25,14 @@ def _init(self):
self.log.debug("Constructing IOCtx")
self.ioctx = self._module.rados.open_ioctx(self.pool)

import rbd

self.log.debug("Constructing RBD")
self.rbd = rbd.RBD()

def _get(self):
import rbd

self.log.debug("rbd.list")
names = self.rbd.list(self.ioctx)
result = []
Expand All @@ -54,6 +56,8 @@ def _get(self):
return result

def _format_bitmask(self, features):
import rbd

names = ""
RBD_FEATURES_NAME_MAPPING = {
rbd.RBD_FEATURE_LAYERING: "layering",
Expand Down

0 comments on commit 387c981

Please sign in to comment.