From 7dddecb845821e2b5416d3012bebe725cb22736e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 30 Dec 2015 10:22:35 -0500 Subject: [PATCH] ceph-objectstore-tool: get store type from 'type' file, if present Just like ceph-osd. Signed-off-by: Sage Weil --- src/tools/ceph_objectstore_tool.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 23affbfc7ba..e4186fbae15 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -2309,7 +2309,19 @@ int main(int argc, char **argv) ceph_options.push_back(i->c_str()); } - if (!vm.count("type")) { + char fn[PATH_MAX]; + snprintf(fn, sizeof(fn), "%s/type", dpath.c_str()); + int fd = ::open(fn, O_RDONLY); + if (fd >= 0) { + bufferlist bl; + bl.read_fd(fd, 64); + if (bl.length()) { + type = string(bl.c_str(), bl.length() - 1); // drop \n + //cout << "object store type is " << type << std::endl; + } + ::close(fd); + } + if (!vm.count("type") && type == "") { type = "filestore"; } if (!vm.count("data-path") && -- 2.47.3