Merge pull request #2354 from dachary/wip-9273-mon-preload-erasure-code

erasure-code: preload the default plugins in the mon

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-08-29 08:17:06 -07:00
commit 150542dd59
2 changed files with 22 additions and 0 deletions

View File

@ -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);

View File

@ -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