]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_objectstore_tool: Verify that object pool and pgid pool match
authorDavid Zafman <dzafman@redhat.com>
Fri, 5 Dec 2014 23:12:21 +0000 (15:12 -0800)
committerDavid Zafman <dzafman@redhat.com>
Tue, 3 Mar 2015 19:21:00 +0000 (11:21 -0800)
Also, earlier check for invalid --pgid with import op

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit da3be80497a1b1878ee5d2015f8840d202a83aa2)

src/tools/ceph_objectstore_tool.cc

index 1360b14830e61113689d5225ab8e5dfe35b1f4de..244fa3a55f628858a9d0ae7ee033763558514dfc 100644 (file)
@@ -2352,6 +2352,11 @@ int main(int argc, char **argv)
     }
   }
 
+  if (op == "import" && pgidstr.length()) {
+    cerr << "--pgid option invalid with import" << std::endl;
+    return 1;
+  }
+
   ObjectStore *fs = ObjectStore::create(g_ceph_context, type, dpath, jpath, flags);
   if (fs == NULL) {
     cerr << "Must provide --type (filestore, memstore, keyvaluestore-dev)" << std::endl;
@@ -2420,11 +2425,6 @@ int main(int argc, char **argv)
     return 1;
   }
 
-  if (op == "import" && pgidstr.length()) {
-    cerr << "--pgid option invalid with import" << std::endl;
-    return 1;
-  }
-
   if (op != "list" && vm.count("object")) {
     json_spirit::Value v;
     try {
@@ -2487,6 +2487,11 @@ int main(int argc, char **argv)
          ss << "Decode object json error: " << e.what();
          throw std::runtime_error(ss.str());
        }
+        if ((uint64_t)pgid.pgid.m_pool != (uint64_t)ghobj.hobj.pool) {
+          cerr << "Object pool and pgid pool don't match" << std::endl;
+          ret = 1;
+          goto out;
+        }
       }
     } catch (std::runtime_error& e) {
       cerr << e.what() << std::endl;