Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erasure-code: preload the default plugins in the mon (firefly) #2356

Merged
merged 1 commit into from Aug 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/ceph_mon.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -184,6 +186,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;
Expand Down Expand Up @@ -416,6 +433,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);
Expand Down
4 changes: 4 additions & 0 deletions src/test/mon/mkfs.sh
Expand Up @@ -43,6 +43,7 @@ function mon_mkfs() {
--id $MON_ID \
--fsid $fsid \
--mkfs \
--osd-pool-default-erasure-code-directory=.libs \
--mon-data=$MON_DIR \
--mon-initial-members=$MON_ID \
--mon-host=$MONA \
Expand All @@ -54,6 +55,7 @@ function mon_run() {
--id $MON_ID \
--chdir= \
--mon-data=$MON_DIR \
--osd-pool-default-erasure-code-directory=.libs \
--log-file=$MON_DIR/log \
--mon-cluster-log-file=$MON_DIR/log \
--run-dir=$MON_DIR \
Expand All @@ -76,6 +78,7 @@ function auth_none() {

./ceph-mon \
--id $MON_ID \
--osd-pool-default-erasure-code-directory=.libs \
--mon-data=$MON_DIR \
--extract-monmap $MON_DIR/monmap

Expand Down Expand Up @@ -136,6 +139,7 @@ function makedir() {
./ceph-mon \
--id $MON_ID \
--mkfs \
--osd-pool-default-erasure-code-directory=.libs \
--mon-data=$toodeep 2>&1 | tee $DIR/makedir.log
grep 'toodeep.*No such file' $DIR/makedir.log > /dev/null
rm $DIR/makedir.log
Expand Down