#include "mds/MDSMap.h"
#include "osd/OSDMap.h"
#include "mon/PGMap.h"
+#include "common/common_init.h"
void usage()
{
vector<const char*> args;
argv_to_vec(argc, argv, args);
DEFINE_CONF_VARS(usage);
+ common_init(args, "mkmonfs", false);
bool clobber = false;
- const char *fsdir = 0;
int whoami = -1;
- const char *monmapfn = 0;
+ const char *monmapfn = g_conf.monmap;
const char *osdmapfn = 0;
FOR_EACH_ARG(args) {
CONF_SAFE_SET_ARG_VAL(&monmapfn, OPT_STR);
} else if (CONF_ARG_EQ("osdmap", '\0')) {
CONF_SAFE_SET_ARG_VAL(&osdmapfn, OPT_STR);
- } else if (CONF_ARG_EQ("mon_data", '\0')) {
- CONF_SAFE_SET_ARG_VAL(&fsdir, OPT_STR);
} else
usage();
}
- if (!fsdir || !monmapfn || whoami < 0)
+ if (!g_conf.mon_data || !monmapfn || whoami < 0)
usage();
if (!clobber) {
// make sure it doesn't exist
struct stat st;
- if (::lstat(fsdir, &st) == 0) {
- cerr << "monfs dir " << fsdir << " already exists; remove it first" << std::endl;
+ if (::lstat(g_conf.mon_data, &st) == 0) {
+ cerr << "monfs dir " << g_conf.mon_data << " already exists; remove it first" << std::endl;
usage();
}
}
exit(1);
// go
- MonitorStore store(fsdir);
+ MonitorStore store(g_conf.mon_data);
Monitor mon(whoami, &store, 0, &monmap);
mon.mkfs(osdmapbl);
- cout << argv[0] << ": created monfs at " << fsdir
+ cout << argv[0] << ": created monfs at " << g_conf.mon_data
<< " for mon" << whoami
<< std::endl;
return 0;