usr/bin/cmon
usr/bin/cmds
usr/bin/cosd
-usr/bin/mkmonfs
usr/bin/cauthtool
usr/bin/rados
usr/bin/rbdtool
# admin tools
ceph_SOURCES = ceph.cc msg/SimpleMessenger.cc
ceph_LDADD = libcrush.a libcommon.a -ledit -lpthread -lm -lcrypto
-mkmonfs_SOURCES = mkmonfs.cc
-mkmonfs_LDADD = libmon.a libcrush.a libcommon.a -lpthread -lm -lcrypto
cconf_SOURCES = cconf.cc
cconf_LDADD = libcommon.a -lpthread -lm -lcrypto
cauthtool_SOURCES = cauthtool.cc
cauthtool_LDADD = libcommon.a -lpthread -lm -lcrypto
-bin_PROGRAMS += ceph mkmonfs cconf cauthtool
+bin_PROGRAMS += ceph cconf cauthtool
monmaptool_SOURCES = monmaptool.cc
monmaptool_LDADD = libcommon.a -lpthread -lm -lcrypto
noinst_PROGRAMS = mount.ceph
-core: cmon cosd cmds mkmonfs ceph cconf monmaptool osdmaptool crushtool
+core: cmon cosd cmds ceph cconf monmaptool osdmaptool crushtool
dumpjournal_SOURCES = dumpjournal.cc msg/SimpleMessenger.cc
rgw/rgw_user.h\
sample.ceph.conf
-all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(mkmonfs_SOURCES) $(cauthtool_SOURCES) $(monmaptool_SOURCES) \
+all_sources = $(cmon_SOURCES) $(ceph_SOURCES) $(cauthtool_SOURCES) $(monmaptool_SOURCES) \
$(crushtool_SOURCES) $(osdmaptool_SOURCES) $(cconf_SOURCES) $(mount_ceph_SOURCES) $(cmds_SOURCES) \
$(dumpjournal_SOURCES) $(cosd_SOURCES) $(dupstore_SOURCES) $(streamtest_SOURCES) $(csyn_SOURCES) \
$(testmsgr_SOURCES) $(cfuse_SOURCES) $(fakefuse_SOURCES) $(psim_SOURCES) \
cerr << "usage: cmon -i monid [--mon-data=pathtodata] [flags]" << std::endl;
cerr << " --debug_mon n\n";
cerr << " debug monitor level (e.g. 10)\n";
+ cerr << " --mkfs\n";
+ cerr << " build fresh monitor fs\n";
generic_server_usage();
}
int main(int argc, const char **argv)
{
int err;
+ DEFINE_CONF_VARS(usage);
+
+ bool mkfs = false;
+ const char *osdmapfn = 0;
vector<const char*> args;
argv_to_vec(argc, argv, args);
env_to_vec(args);
common_init(args, "mon", true, true);
+ FOR_EACH_ARG(args) {
+ if (CONF_ARG_EQ("mkfs", '\0')) {
+ mkfs = true;
+ } else if (CONF_ARG_EQ("osdmap", '\0')) {
+ CONF_SAFE_SET_ARG_VAL(&osdmapfn, OPT_STR);
+ } else
+ usage();
+ }
+
// whoami
char *end;
int whoami = strtol(g_conf.id, &end, 10);
usage();
}
+ // -- mkfs --
+ if (mkfs) {
+ if (!g_conf.monmap || !osdmapfn)
+ usage();
+
+ // make sure it doesn't already exist
+ /*
+ struct stat st;
+ if (::lstat(g_conf.mon_data, &st) == 0) {
+ cerr << "monfs dir " << g_conf.mon_data << " already exists; remove it first" << std::endl;
+ usage();
+ }
+ */
+
+ // load monmap
+ bufferlist monmapbl, osdmapbl;
+ int err = monmapbl.read_file(g_conf.monmap);
+ if (err < 0)
+ exit(1);
+ MonMap monmap;
+ monmap.decode(monmapbl);
+
+ err = osdmapbl.read_file(osdmapfn);
+ if (err < 0)
+ exit(1);
+
+ // go
+ MonitorStore store(g_conf.mon_data);
+ Monitor mon(whoami, &store, 0, &monmap);
+ mon.mkfs(osdmapbl);
+ cout << argv[0] << ": created monfs at " << g_conf.mon_data
+ << " for mon" << whoami
+ << std::endl;
+ return 0;
+ }
+
if (g_conf.clock_tare) g_clock.tare();
CompatSet mon_features(ceph_mon_feature_compat,
[ -n "$user" ] && chown $user $tmpkeyring
fi
get_conf mon_data "" "mon data"
- do_cmd "$BINDIR/mkmonfs --clobber --mon-data $mon_data -i $num --monmap $monmap --osdmap $osdmap -k $tmpkeyring ; rm -f $tmpkeyring"
+ do_cmd "$BINDIR/cmon --mkfs -i $num --monmap $monmap --osdmap $osdmap -k $tmpkeyring ; rm -f $tmpkeyring"
if [ -n "$ssh" ]; then
if [ -n "$user" ]; then
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-#include "common/common_init.h"
-#include "mon/MonitorStore.cc"
-#include "config.h"
-
-#include "mon/Monitor.h"
-#include "mon/MonMap.h"
-#include "mds/MDSMap.h"
-#include "osd/OSDMap.h"
-#include "mon/PGMap.h"
-#include "common/common_init.h"
-
-void usage()
-{
- cerr << "usage: ./mkmonfs [--clobber] --mon-data <monfsdir> -i <monid> --monmap <file> --osdmap <file>" << std::endl;
- exit(1);
-}
-
-
-int main(int argc, const char **argv)
-{
- vector<const char*> args;
- argv_to_vec(argc, argv, args);
- DEFINE_CONF_VARS(usage);
- common_init(args, "mon", false, false);
-
- bool clobber = false;
- int whoami = -1;
- const char *osdmapfn = 0;
-
- FOR_EACH_ARG(args) {
- if (CONF_ARG_EQ("clobber", '\0')) {
- CONF_SAFE_SET_ARG_VAL(&clobber, OPT_BOOL);
- } else if (CONF_ARG_EQ("mon", 'i')) {
- CONF_SAFE_SET_ARG_VAL(&whoami, OPT_INT);
- } else if (CONF_ARG_EQ("osdmap", '\0')) {
- CONF_SAFE_SET_ARG_VAL(&osdmapfn, OPT_STR);
- } else {
- usage();
- }
- }
- if (!g_conf.mon_data || !g_conf.monmap || whoami < 0)
- usage();
-
- if (!clobber) {
- // make sure it doesn't exist
- struct stat st;
- if (::lstat(g_conf.mon_data, &st) == 0) {
- cerr << "monfs dir " << g_conf.mon_data << " already exists; remove it first" << std::endl;
- usage();
- }
- }
-
- // load monmap
- bufferlist monmapbl, osdmapbl;
- int err = monmapbl.read_file(g_conf.monmap);
- if (err < 0)
- exit(1);
- MonMap monmap;
- monmap.decode(monmapbl);
-
- err = osdmapbl.read_file(osdmapfn);
- if (err < 0)
- exit(1);
-
- // go
- MonitorStore store(g_conf.mon_data);
- Monitor mon(whoami, &store, 0, &monmap);
- mon.mkfs(osdmapbl);
- cout << argv[0] << ": created monfs at " << g_conf.mon_data
- << " for mon" << whoami
- << std::endl;
- return 0;
-}
for f in `seq 0 $((CEPH_NUM_MON-1))`
do
- cmd="$CEPH_BIN/mkmonfs -c $conf --clobber --mon-data=dev/mon$f -i $f --monmap=$monmap_fn --osdmap=$osdmap_fn"
+ cmd="$CEPH_BIN/cmon --mkfs -c $conf -i $f --monmap=$monmap_fn --osdmap=$osdmap_fn"
[ "$cephx" -eq 1 ] && cmd="$cmd --keyring=$keyring_fn"
echo $cmd
$cmd