From 2a7e2f2ebdd97a34e444b310bfc13682b769d72e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 6 Nov 2009 16:48:38 -0800 Subject: [PATCH] osdmaptool: test-map-object --- src/osdmaptool.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/osdmaptool.cc b/src/osdmaptool.cc index acb427aae3a87..73e9df4a5f32a 100644 --- a/src/osdmaptool.cc +++ b/src/osdmaptool.cc @@ -62,6 +62,7 @@ int main(int argc, const char **argv) const char *import_crush = 0; list add, rm; const char *test_map_pg = 0; + const char *test_map_object = 0; bool test_crush = false; FOR_EACH_ARG(args) { @@ -84,6 +85,8 @@ int main(int argc, const char **argv) CONF_SAFE_SET_ARG_VAL(&import_crush, OPT_STR); } else if (CONF_ARG_EQ("test_map_pg", '\0')) { CONF_SAFE_SET_ARG_VAL(&test_map_pg, OPT_STR); + } else if (CONF_ARG_EQ("test_map_object", '\0')) { + CONF_SAFE_SET_ARG_VAL(&test_map_object, OPT_STR); } else if (CONF_ARG_EQ("test_crush", '\0')) { CONF_SAFE_SET_ARG_VAL(&test_crush, OPT_BOOL); } else if (!fn) @@ -160,6 +163,20 @@ int main(int argc, const char **argv) cout << me << ": exported crush map to " << export_crush << std::endl; } + if (test_map_object) { + object_t oid(test_map_object); + ceph_object_layout ol = osdmap.make_object_layout(oid, 0); + + pg_t pgid; + pgid.v = ol.ol_pgid; + + vector acting; + osdmap.pg_to_acting_osds(pgid, acting); + cout << " object '" << oid + << "' -> " << pgid + << " -> " << acting + << std::endl; + } if (test_map_pg) { pg_t pgid; if (pgid.parse(test_map_pg) < 0) { @@ -204,7 +221,7 @@ int main(int argc, const char **argv) } } - if (!print && !modified && !export_crush && !import_crush && !test_map_pg) { + if (!print && !modified && !export_crush && !import_crush && !test_map_pg && !test_map_object) { cerr << me << ": no action specified?" << std::endl; usage(); } -- 2.39.5