From 76b8e57ba691c102070dab8ba202027d40a694c6 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Fri, 29 Aug 2014 12:06:49 +0200 Subject: [PATCH] erasure-code: preload the default plugins in the mon The commit 9b802701f78288ba4f706c65b853415c69002d27 preloads the supported plugins in the OSD. They must also be preloaded in the mon for the same reasons. http://tracker.ceph.com/issues/9273 Fixes: #9273 Signed-off-by: Loic Dachary --- src/ceph_mon.cc | 19 +++++++++++++++++++ src/test/erasure-code/test-erasure-code.sh | 3 +++ 2 files changed, 22 insertions(+) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 87f829bbbd445..5db3253414d69 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -43,6 +43,8 @@ using namespace std; #include "include/assert.h" +#include "erasure-code/ErasureCodePlugin.h" + #define dout_subsys ceph_subsys_mon Monitor *mon = NULL; @@ -182,6 +184,21 @@ void usage() generic_server_usage(); } +int preload_erasure_code() +{ + string directory = g_conf->osd_pool_default_erasure_code_directory; + string plugins = g_conf->osd_erasure_code_plugins; + stringstream ss; + int r = ErasureCodePluginRegistry::instance().preload(plugins, + directory, + ss); + if (r) + derr << ss.str() << dendl; + else + dout(10) << ss.str() << dendl; + return r; +} + int main(int argc, const char **argv) { int err; @@ -466,6 +483,8 @@ int main(int argc, const char **argv) } common_init_finish(g_ceph_context); global_init_chdir(g_ceph_context); + if (preload_erasure_code() < -1) + prefork.exit(1); } MonitorDBStore *store = new MonitorDBStore(g_conf->mon_data); diff --git a/src/test/erasure-code/test-erasure-code.sh b/src/test/erasure-code/test-erasure-code.sh index 7c2c17c9a783a..8ad52a09045c4 100755 --- a/src/test/erasure-code/test-erasure-code.sh +++ b/src/test/erasure-code/test-erasure-code.sh @@ -27,6 +27,9 @@ function run() { setup $dir || return 1 run_mon $dir a --public-addr 127.0.0.1 || return 1 + # check that erasure code plugins are preloaded + CEPH_ARGS='' ./ceph --admin-daemon $dir/a/ceph-mon.a.asok log flush || return 1 + grep 'load: jerasure' $dir/a/log || return 1 for id in $(seq 0 4) ; do run_osd $dir $id || return 1 done -- 2.39.5