From: Sage Weil Date: Sat, 7 Nov 2009 00:48:38 +0000 (-0800) Subject: osdmaptool: test-map-object X-Git-Tag: v0.18~128^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a7e2f2ebdd97a34e444b310bfc13682b769d72e;p=ceph.git osdmaptool: test-map-object --- diff --git a/src/osdmaptool.cc b/src/osdmaptool.cc index acb427aae3a8..73e9df4a5f32 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(); }