exit(1);
}
- MonitorDBStore *store = new MonitorDBStore(g_conf()->mon_data);
+ MonitorDBStore store(g_conf()->mon_data);
// -- mkfs --
if (mkfs) {
// go
ostringstream oss;
- int r = store->create_and_open(oss);
+ int r = store.create_and_open(oss);
if (oss.tellp())
derr << oss.str() << dendl;
if (r < 0) {
}
ceph_assert(r == 0);
- Monitor mon(g_ceph_context, g_conf()->name.get_id(), store, 0, 0, &monmap);
+ Monitor mon(g_ceph_context, g_conf()->name.get_id(), &store, 0, 0, &monmap);
r = mon.mkfs(osdmapbl);
if (r < 0) {
derr << argv[0] << ": error creating monfs: " << cpp_strerror(r) << dendl;
exit(1);
}
- store->close();
+ store.close();
dout(0) << argv[0] << ": created monfs at " << g_conf()->mon_data
<< " for " << g_conf()->name << dendl;
return 0;
// make sure we aren't upgrading too fast
{
string val;
- int r = store->read_meta("min_mon_release", &val);
+ int r = store.read_meta("min_mon_release", &val);
if (r >= 0 && val.size()) {
ceph_release_t from_release = ceph_release_from_name(val);
ostringstream err;
{
ostringstream oss;
- err = store->open(oss);
+ err = store.open(oss);
if (oss.tellp())
derr << oss.str() << dendl;
if (err < 0) {
}
bufferlist magicbl;
- err = store->get(Monitor::MONITOR_NAME, "magic", magicbl);
+ err = store.get(Monitor::MONITOR_NAME, "magic", magicbl);
if (err || !magicbl.length()) {
derr << "unable to read magic from mon data" << dendl;
prefork.exit(1);
prefork.exit(1);
}
- err = Monitor::check_features(store);
+ err = Monitor::check_features(&store);
if (err < 0) {
derr << "error checking features: " << cpp_strerror(err) << dendl;
prefork.exit(1);
}
// get next version
- version_t v = store->get("monmap", "last_committed");
+ version_t v = store.get("monmap", "last_committed");
dout(0) << "last committed monmap epoch is " << v << ", injected map will be " << (v+1)
<< dendl;
v++;
t->put("monmap", v, mapbl);
t->put("monmap", "latest", final);
t->put("monmap", "last_committed", v);
- store->apply_transaction(t);
+ store.apply_transaction(t);
dout(0) << "done." << dendl;
prefork.exit(0);
// note that even if we don't find a viable monmap, we should go ahead
// and try to build it up in the next if-else block.
bufferlist mapbl;
- int err = obtain_monmap(*store, mapbl);
+ int err = obtain_monmap(store, mapbl);
if (err >= 0) {
try {
monmap.decode(mapbl);
prefork.exit(1);
}
- mon = new Monitor(g_ceph_context, g_conf()->name.get_id(), store,
+ mon = new Monitor(g_ceph_context, g_conf()->name.get_id(), &store,
msgr, mgr_msgr, &monmap);
mon->orig_argc = argc;
msgr->wait();
mgr_msgr->wait();
- store->close();
+ store.close();
unregister_async_signal_handler(SIGHUP, handle_mon_signal);
unregister_async_signal_handler(SIGINT, handle_mon_signal);
shutdown_async_signal_handler();
delete mon;
- delete store;
delete msgr;
delete mgr_msgr;
delete client_throttler;