ceph-monstore-tool: implement getmonmap

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-05-21 13:27:42 -07:00
parent bcc8bfdb67
commit 5671fa9fe5

View File

@ -204,6 +204,27 @@ int main(int argc, char **argv) {
}
} else if (cmd == "compact") {
st.compact();
} else if (cmd == "getmonmap") {
if (!store_path.size()) {
std::cerr << "need mon store path" << std::endl;
std::cerr << desc << std::endl;
goto done;
}
version_t v;
if (version <= 0) {
v = st.get("monmap", "last_committed");
} else {
v = version;
}
bufferlist bl;
/// XXX: this is not ok, osdmap and full should be abstracted somewhere
int r = st.get("monmap", v, bl);
if (r < 0) {
std::cerr << "Error getting map: " << cpp_strerror(r) << std::endl;
goto done;
}
bl.write_fd(fd);
} else if (cmd == "getosdmap") {
if (!store_path.size()) {
std::cerr << "need mon store path" << std::endl;