summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@inktank.com>2013-04-29 14:32:00 -0700
committerJosh Durgin <josh.durgin@inktank.com>2013-04-29 14:32:00 -0700
commit305ad861627e8cb8cadff8f5b220041d76ac89bc (patch)
tree3075d68ed97914e25d451f8d5e9cfae5bc28332c
parent9e794ba474fe7dcb33ff677b80b519bf96dd8826 (diff)
downloadceph-wip-rbd-close-image.tar.gz
Revert "tools: add ceph_monstore_tool with getosdmap"wip-rbd-close-image
This reverts commit 1e6c390a67b2500d5a934b6537b8c7e9e1f096c6.
-rw-r--r--src/Makefile.am7
-rw-r--r--src/tools/ceph-monstore-tool.cc132
2 files changed, 0 insertions, 139 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 476c80e8027..c4e08ba1d79 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -128,13 +128,6 @@ ceph_filestore_dump_LDADD += -ldl
endif
bin_PROGRAMS += ceph ceph-conf ceph-authtool ceph_filestore_dump
-ceph_monstore_tool_SOURCES = tools/ceph-monstore-tool.cc \
- os/LevelDBStore.cc
-ceph_monstore_tool_LDFLAGS = ${AM_LDFLAGS}
-ceph_monstore_tool_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -lboost_program_options
-ceph_monstore_tool_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS}
-bin_PROGRAMS += ceph_monstore_tool
-
monmaptool_SOURCES = monmaptool.cc
monmaptool_LDADD = $(LIBGLOBAL_LDA)
crushtool_SOURCES = crushtool.cc
diff --git a/src/tools/ceph-monstore-tool.cc b/src/tools/ceph-monstore-tool.cc
deleted file mode 100644
index 9b6a22afd02..00000000000
--- a/src/tools/ceph-monstore-tool.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-// -*- 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) 2012 Inktank, Inc.
-*
-* 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 <boost/scoped_ptr.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/program_options/option.hpp>
-#include <boost/program_options/options_description.hpp>
-#include <boost/program_options/variables_map.hpp>
-#include <boost/program_options/cmdline.hpp>
-#include <boost/program_options/parsers.hpp>
-#include <iostream>
-#include <set>
-#include <sstream>
-#include <stdlib.h>
-#include <fstream>
-#include <string>
-#include <sstream>
-#include <map>
-#include <set>
-#include <boost/scoped_ptr.hpp>
-
-#include "global/global_init.h"
-#include "os/LevelDBStore.h"
-#include "mon/MonitorDBStore.h"
-
-namespace po = boost::program_options;
-using namespace std;
-
-int main(int argc, char **argv) {
- po::options_description desc("Allowed options");
- int version = -1;
- string store_path, cmd, out_path;
- desc.add_options()
- ("help", "produce help message")
- ("mon-store-path", po::value<string>(&store_path),
- "path to mon directory, mandatory")
- ("out", po::value<string>(&out_path),
- "out path")
- ("version", po::value<int>(&version),
- "version requested")
- ("command", po::value<string>(&cmd),
- "command")
- ;
- po::positional_options_description p;
- p.add("command", 1);
- p.add("version", 1);
-
- po::variables_map vm;
- po::parsed_options parsed =
- po::command_line_parser(argc, argv).options(desc).positional(p).run();
- po::store(
- parsed,
- vm);
- try {
- po::notify(vm);
- } catch (...) {
- cout << desc << std::endl;
- return 1;
- }
-
- vector<const char *> ceph_options, def_args;
- vector<string> ceph_option_strings = po::collect_unrecognized(
- parsed.options, po::include_positional);
- ceph_options.reserve(ceph_option_strings.size());
- for (vector<string>::iterator i = ceph_option_strings.begin();
- i != ceph_option_strings.end();
- ++i) {
- ceph_options.push_back(i->c_str());
- }
-
- global_init(
- &def_args, ceph_options, CEPH_ENTITY_TYPE_OSD,
- CODE_ENVIRONMENT_UTILITY, 0);
- common_init_finish(g_ceph_context);
- g_ceph_context->_conf->apply_changes(NULL);
- g_conf = g_ceph_context->_conf;
-
- if (vm.count("help")) {
- std::cerr << desc << std::endl;
- return 1;
- }
-
- int fd;
- if (vm.count("out")) {
- fd = open(out_path.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666);
- } else {
- fd = STDOUT_FILENO;
- }
-
- MonitorDBStore st(store_path);
- stringstream ss;
- int r = st.open(ss);
- if (r < 0) {
- std::cerr << ss.str() << std::endl;
- goto done;
- }
- if (cmd == "getosdmap") {
- version_t v;
- if (version == -1) {
- v = st.get("osdmap", "last_committed");
- } else {
- v = version;
- }
-
- bufferlist bl;
- /// XXX: this is not ok, osdmap and full should be abstracted somewhere
- int r = st.get("osdmap", st.combine_strings("full", v), bl);
- if (r < 0) {
- std::cerr << "Error getting map: " << cpp_strerror(r) << std::endl;
- goto done;
- }
- bl.write_fd(fd);
- } else {
- std::cerr << "Unrecognized command: " << cmd << std::endl;
- goto done;
- }
-
- done:
- if (vm.count("out")) {
- ::close(fd);
- }
- return 0;
-}