From: David Zafman Date: Fri, 5 Dec 2014 23:12:21 +0000 (-0800) Subject: ceph_objectstore_tool: Verify that object pool and pgid pool match X-Git-Tag: v0.80.10~69^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3de607c2ce16a26af7a78a4e557f321ffbcb44d;p=ceph.git ceph_objectstore_tool: Verify that object pool and pgid pool match Also, earlier check for invalid --pgid with import op Signed-off-by: David Zafman (cherry picked from commit da3be80497a1b1878ee5d2015f8840d202a83aa2) --- diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 1360b14830e6..244fa3a55f62 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -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;