diff options
author | Sage Weil <sage@redhat.com> | 2016-06-30 16:54:26 +0200 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2016-06-30 17:06:21 +0200 |
commit | 42c640e76c437352ec8ac20965ff2dd8e4696b1d (patch) | |
tree | 66a163c74e2aae3ec46b5a3833e3517ad44dbf1c /src | |
parent | do_cmake.sh: create initial ceph.conf setting dirs (diff) | |
download | ceph-42c640e76c437352ec8ac20965ff2dd8e4696b1d.tar.xz ceph-42c640e76c437352ec8ac20965ff2dd8e4696b1d.zip |
common/PluginRegistry: try $plugin_dir/$foo if $plugin_dir/$type/$foo fails
This is helpful for running out of a build dir, where e.g. cmake puts
stuff in lib/* and type separated into subdirs by type.
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/common/PluginRegistry.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/PluginRegistry.cc b/src/common/PluginRegistry.cc index fb02d4a45a5..661df1c74e5 100644 --- a/src/common/PluginRegistry.cc +++ b/src/common/PluginRegistry.cc @@ -142,9 +142,15 @@ int PluginRegistry::load(const std::string &type, + name + PLUGIN_SUFFIX; void *library = dlopen(fname.c_str(), RTLD_NOW); if (!library) { - lderr(cct) << __func__ << " failed dlopen(" << fname << "): " - << dlerror() << dendl; - return -EIO; + // fall back to plugin_dir + std::string fname2 = cct->_conf->plugin_dir + "/" + PLUGIN_PREFIX + + name + PLUGIN_SUFFIX; + library = dlopen(fname2.c_str(), RTLD_NOW); + if (!library) { + lderr(cct) << __func__ << " failed dlopen(" << fname << ") or dlopen(" + << fname2 << "): " << dlerror() << dendl; + return -EIO; + } } const char * (*code_version)() = |