Skip to content

Commit

Permalink
mon: implement --extract-monmap <filename>
Browse files Browse the repository at this point in the history
This will make for a simpler process for
  http://ceph.com/docs/master/rados/operations/add-or-rm-mons/#removing-monitors-from-an-unhealthy-cluster

Signed-off-by: Sage Weil <sage@inktank.com>
  • Loading branch information
Sage Weil committed May 21, 2013
1 parent 0822b36 commit c0268e2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/ceph_mon.cc
Expand Up @@ -116,7 +116,7 @@ int main(int argc, const char **argv)

bool mkfs = false;
bool compact = false;
std::string osdmapfn, inject_monmap;
std::string osdmapfn, inject_monmap, extract_monmap;

vector<const char*> args;
argv_to_vec(argc, argv, args);
Expand All @@ -140,6 +140,8 @@ int main(int argc, const char **argv)
osdmapfn = val;
} else if (ceph_argparse_witharg(args, i, &val, "--inject_monmap", (char*)NULL)) {
inject_monmap = val;
} else if (ceph_argparse_witharg(args, i, &val, "--extract-monmap", (char*)NULL)) {
extract_monmap = val;
} else {
++i;
}
Expand Down Expand Up @@ -380,11 +382,21 @@ int main(int argc, const char **argv)
cerr << "can't decode monmap: " << e.what() << std::endl;
}
} else {
std::cerr << "unable to obtain a monmap: "
<< cpp_strerror(err) << std::endl;
derr << "unable to obtain a monmap: " << cpp_strerror(err) << dendl;
}
if (!extract_monmap.empty()) {
int r = mapbl.write_file(extract_monmap.c_str());
if (r < 0) {
r = -errno;
derr << "error writing monmap to " << extract_monmap << ": " << cpp_strerror(r) << dendl;
prefork.exit(1);
}
derr << "wrote monmap to " << extract_monmap << dendl;
prefork.exit(0);
}
}


// this is what i will bind to
entity_addr_t ipaddr;

Expand Down

0 comments on commit c0268e2

Please sign in to comment.