From c3de607c2ce16a26af7a78a4e557f321ffbcb44d Mon Sep 17 00:00:00 2001 From: David Zafman Date: Fri, 5 Dec 2014 15:12:21 -0800 Subject: [PATCH] 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) --- src/tools/ceph_objectstore_tool.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 1360b14830e61..244fa3a55f628 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; -- 2.39.5