]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-objectstore-tool: get store type from 'type' file, if present
authorSage Weil <sage@redhat.com>
Wed, 30 Dec 2015 15:22:35 +0000 (10:22 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:09:16 +0000 (13:09 -0500)
Just like ceph-osd.

Signed-off-by: Sage Weil <sage@redhat.com>
src/tools/ceph_objectstore_tool.cc

index 23affbfc7ba71c59067cb9f277d9f16ea962dacf..e4186fbae1533af55142babcabd71780a3622397 100644 (file)
@@ -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") &&