{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/55622175","id":55622175,"diff_hunk":"@@ -1277,6 +1278,41 @@ Rados object in state %s.\" % self.state)\n         if ret < 0:\n             raise make_ex(ret, \"error blacklisting client '%s'\" % client_address)\n \n+    def map_object(self, obj_name, pool_id=-1):\n+        \"\"\"\n+        Map an object\n+\n+        :param obj_name: the name of the object to find\n+        :type obj_name: str\n+        :param pool_id: id of the pool to look up\n+        :type pool_id: int\n+\n+        :raises: :class:`Error`\n+        :returns: dict of OSD up/acting set\n+        \"\"\"\n+        self.require_state(\"connected\")\n+        obj_name =  cstr(obj_name, 'obj_name')\n+        cdef:\n+            uint32_t _pool_id = pool_id\n+            char *_obj_name = obj_name\n+            char *up_set = NULL\n+            char *acting_set = NULL\n+            size_t up_size, acting_size\n+\n+        try:\n+            up_set = <char *>realloc_chk(up_set, 512)\n+            acting_set = <char *>realloc_chk(acting_set, 512)\n+            with nogil:\n+                ret = rados_map_object(self.cluster, _obj_name, up_set, &up_size,\n+                                       acting_set, &acting_size, _pool_id)\n+\n+            if ret < 0:\n+                raise make_ex(ret, \"error map object '%s'\" % obj_name)\n+            return ({'up': up_set, 'acting': acting_set})","path":"src/pybind/rados/rados.pyx","position":42,"original_position":42,"commit_id":"7337d2b714d82696453ecd628d79a1d5cce29846","original_commit_id":"7337d2b714d82696453ecd628d79a1d5cce29846","user":{"login":"jdurgin","id":1022584,"avatar_url":"https://avatars.githubusercontent.com/u/1022584?v=3","gravatar_id":"","url":"https://api.github.com/users/jdurgin","html_url":"https://github.com/jdurgin","followers_url":"https://api.github.com/users/jdurgin/followers","following_url":"https://api.github.com/users/jdurgin/following{/other_user}","gists_url":"https://api.github.com/users/jdurgin/gists{/gist_id}","starred_url":"https://api.github.com/users/jdurgin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdurgin/subscriptions","organizations_url":"https://api.github.com/users/jdurgin/orgs","repos_url":"https://api.github.com/users/jdurgin/repos","events_url":"https://api.github.com/users/jdurgin/events{/privacy}","received_events_url":"https://api.github.com/users/jdurgin/received_events","type":"User","site_admin":false},"body":"seems like it would be easier to consume this api if it returned up_set and acting_set as lists of ints here as well","created_at":"2016-03-10T01:32:28Z","updated_at":"2016-03-10T01:32:28Z","html_url":"https://github.com/ceph/ceph/pull/7749#discussion_r55622175","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/7749","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/55622175"},"html":{"href":"https://github.com/ceph/ceph/pull/7749#discussion_r55622175"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7749"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/7749","id":60274023,"html_url":"https://github.com/ceph/ceph/pull/7749","diff_url":"https://github.com/ceph/ceph/pull/7749.diff","patch_url":"https://github.com/ceph/ceph/pull/7749.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/7749","number":7749,"state":"open","locked":false,"title":"librados: add map_object API","user":{"login":"zhouyuan","id":43917,"avatar_url":"https://avatars.githubusercontent.com/u/43917?v=3","gravatar_id":"","url":"https://api.github.com/users/zhouyuan","html_url":"https://github.com/zhouyuan","followers_url":"https://api.github.com/users/zhouyuan/followers","following_url":"https://api.github.com/users/zhouyuan/following{/other_user}","gists_url":"https://api.github.com/users/zhouyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouyuan/subscriptions","organizations_url":"https://api.github.com/users/zhouyuan/orgs","repos_url":"https://api.github.com/users/zhouyuan/repos","events_url":"https://api.github.com/users/zhouyuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhouyuan/received_events","type":"User","site_admin":false},"body":"Ceph use crush algorithm to provide the mapping of objects to OSD servers.\r\nHowever there's no public API for this instead you'll have to rely on the\r\ncommand to monitor:\r\n\r\n$ ceph osd map pool_name obj_name\r\n\r\nThe \"ceph_get_osd_crush_location\" method is made available via libcephfs\r\nbut not avaiale in librados.\r\n\r\nThis patch provides an API to render the object distribution layout in librados.\r\nWith this the application could choose which nodes to access, for load-balance\r\npurpose.\r\n\r\nSigned-off-by: Yuan Zhou <yuan.zhou@intel.com>","created_at":"2016-02-23T01:45:57Z","updated_at":"2016-03-10T01:32:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"998c68e1f11934a431b4c4e0900604d2b2898044","assignee":{"login":"liewegas","id":433031,"avatar_url":"https://avatars.githubusercontent.com/u/433031?v=3","gravatar_id":"","url":"https://api.github.com/users/liewegas","html_url":"https://github.com/liewegas","followers_url":"https://api.github.com/users/liewegas/followers","following_url":"https://api.github.com/users/liewegas/following{/other_user}","gists_url":"https://api.github.com/users/liewegas/gists{/gist_id}","starred_url":"https://api.github.com/users/liewegas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liewegas/subscriptions","organizations_url":"https://api.github.com/users/liewegas/orgs","repos_url":"https://api.github.com/users/liewegas/repos","events_url":"https://api.github.com/users/liewegas/events{/privacy}","received_events_url":"https://api.github.com/users/liewegas/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/7749/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/7749/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/7749/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/7337d2b714d82696453ecd628d79a1d5cce29846","head":{"label":"zhouyuan:librados_map_object","ref":"librados_map_object","sha":"7337d2b714d82696453ecd628d79a1d5cce29846","user":{"login":"zhouyuan","id":43917,"avatar_url":"https://avatars.githubusercontent.com/u/43917?v=3","gravatar_id":"","url":"https://api.github.com/users/zhouyuan","html_url":"https://github.com/zhouyuan","followers_url":"https://api.github.com/users/zhouyuan/followers","following_url":"https://api.github.com/users/zhouyuan/following{/other_user}","gists_url":"https://api.github.com/users/zhouyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouyuan/subscriptions","organizations_url":"https://api.github.com/users/zhouyuan/orgs","repos_url":"https://api.github.com/users/zhouyuan/repos","events_url":"https://api.github.com/users/zhouyuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhouyuan/received_events","type":"User","site_admin":false},"repo":{"id":14332728,"name":"ceph","full_name":"zhouyuan/ceph","owner":{"login":"zhouyuan","id":43917,"avatar_url":"https://avatars.githubusercontent.com/u/43917?v=3","gravatar_id":"","url":"https://api.github.com/users/zhouyuan","html_url":"https://github.com/zhouyuan","followers_url":"https://api.github.com/users/zhouyuan/followers","following_url":"https://api.github.com/users/zhouyuan/following{/other_user}","gists_url":"https://api.github.com/users/zhouyuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouyuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouyuan/subscriptions","organizations_url":"https://api.github.com/users/zhouyuan/orgs","repos_url":"https://api.github.com/users/zhouyuan/repos","events_url":"https://api.github.com/users/zhouyuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhouyuan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhouyuan/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/zhouyuan/ceph","forks_url":"https://api.github.com/repos/zhouyuan/ceph/forks","keys_url":"https://api.github.com/repos/zhouyuan/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhouyuan/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhouyuan/ceph/teams","hooks_url":"https://api.github.com/repos/zhouyuan/ceph/hooks","issue_events_url":"https://api.github.com/repos/zhouyuan/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/zhouyuan/ceph/events","assignees_url":"https://api.github.com/repos/zhouyuan/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/zhouyuan/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/zhouyuan/ceph/tags","blobs_url":"https://api.github.com/repos/zhouyuan/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhouyuan/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhouyuan/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhouyuan/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhouyuan/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/zhouyuan/ceph/languages","stargazers_url":"https://api.github.com/repos/zhouyuan/ceph/stargazers","contributors_url":"https://api.github.com/repos/zhouyuan/ceph/contributors","subscribers_url":"https://api.github.com/repos/zhouyuan/ceph/subscribers","subscription_url":"https://api.github.com/repos/zhouyuan/ceph/subscription","commits_url":"https://api.github.com/repos/zhouyuan/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhouyuan/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhouyuan/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhouyuan/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhouyuan/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/zhouyuan/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhouyuan/ceph/merges","archive_url":"https://api.github.com/repos/zhouyuan/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhouyuan/ceph/downloads","issues_url":"https://api.github.com/repos/zhouyuan/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/zhouyuan/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/zhouyuan/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/zhouyuan/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhouyuan/ceph/labels{/name}","releases_url":"https://api.github.com/repos/zhouyuan/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/zhouyuan/ceph/deployments","created_at":"2013-11-12T13:21:23Z","updated_at":"2015-05-20T13:39:08Z","pushed_at":"2016-03-09T06:12:17Z","git_url":"git://github.com/zhouyuan/ceph.git","ssh_url":"git@github.com:zhouyuan/ceph.git","clone_url":"https://github.com/zhouyuan/ceph.git","svn_url":"https://github.com/zhouyuan/ceph","homepage":"http://ceph.com","size":154357,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ceph:master","ref":"master","sha":"2c01f9116831cfbf7fccf14bcdb637e4ae96d21c","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/ceph/ceph/deployments","created_at":"2011-09-01T21:41:26Z","updated_at":"2016-03-10T01:25:26Z","pushed_at":"2016-03-10T01:30:08Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":190235,"stargazers_count":1928,"watchers_count":1928,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1176,"mirror_url":null,"open_issues_count":282,"forks":1176,"open_issues":282,"watchers":1928,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7749"},"html":{"href":"https://github.com/ceph/ceph/pull/7749"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/7749"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/7749/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7749/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7749/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/7337d2b714d82696453ecd628d79a1d5cce29846"}}}}