diff options
author | Sage Weil <sage@inktank.com> | 2013-05-21 14:36:11 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-21 15:14:47 -0700 |
commit | e9d20ffe19d79a3af0279972c248d903f22c7766 (patch) | |
tree | 57ac374b0f3d3ee9d6614488cd4dad466869d38f | |
parent | d48f1edb07a4d8727ac956f70e663c1b4e33e1dd (diff) | |
download | ceph-e9d20ffe19d79a3af0279972c248d903f22c7766.tar.gz |
mon: implement --extract-monmap <filename>
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>
(cherry picked from commit c0268e27497a4d8228ef54da9d4ca12f3ac1f1bf)
-rw-r--r-- | src/ceph_mon.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 28e897e961a..541c239ef98 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -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); @@ -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; } @@ -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; |