From: Sage Weil Date: Wed, 30 Dec 2015 15:22:35 +0000 (-0500) Subject: ceph-objectstore-tool: get store type from 'type' file, if present X-Git-Tag: v10.0.3~154^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7dddecb845821e2b5416d3012bebe725cb22736e;p=ceph.git ceph-objectstore-tool: get store type from 'type' file, if present Just like ceph-osd. Signed-off-by: Sage Weil --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 23affbfc7ba7..e4186fbae153 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") &&