{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/39116964","id":39116964,"diff_hunk":"@@ -2470,6 +2469,34 @@ static int do_show_status(librados::IoCtx &io_ctx, librbd::Image &image,\n   return 0;\n }\n \n+static int do_rename(librbd::RBD &rbd, librados::IoCtx& io_ctx,\n+\t\t     librbd::Image &image, const char *imgname, const char *destname)\n+{\n+  int r = rbd.open_read_only(io_ctx, image, imgname, NULL);\n+  if (r < 0) {\n+    cerr << \"rbd: error opening image \" << imgname << \": \"\n+         << cpp_strerror(-r) << std::endl;\n+    return -r;\n+  }\n+  bool watch_exists = false;\n+  r = do_show_status(io_ctx, image, imgname, NULL, &watch_exists);","path":"src/rbd.cc","position":54,"original_position":54,"commit_id":"2d205c152699d66c0b074660f5db97689b4a087e","original_commit_id":"2d205c152699d66c0b074660f5db97689b4a087e","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":"moving the listwatchers() part of do_show_status() into a helper that this and do_show_status() use would be clearer","created_at":"2015-09-10T01:34:58Z","updated_at":"2015-09-10T01:34:58Z","html_url":"https://github.com/ceph/ceph/pull/5777#discussion_r39116964","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/5777","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/39116964"},"html":{"href":"https://github.com/ceph/ceph/pull/5777#discussion_r39116964"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5777"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/5777","id":44002672,"html_url":"https://github.com/ceph/ceph/pull/5777","diff_url":"https://github.com/ceph/ceph/pull/5777.diff","patch_url":"https://github.com/ceph/ceph/pull/5777.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/5777","number":5777,"state":"open","locked":false,"title":"rbd: fix ensure watchers is not exists before rename image","user":{"login":"XinzeChi","id":3147032,"avatar_url":"https://avatars.githubusercontent.com/u/3147032?v=3","gravatar_id":"","url":"https://api.github.com/users/XinzeChi","html_url":"https://github.com/XinzeChi","followers_url":"https://api.github.com/users/XinzeChi/followers","following_url":"https://api.github.com/users/XinzeChi/following{/other_user}","gists_url":"https://api.github.com/users/XinzeChi/gists{/gist_id}","starred_url":"https://api.github.com/users/XinzeChi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XinzeChi/subscriptions","organizations_url":"https://api.github.com/users/XinzeChi/orgs","repos_url":"https://api.github.com/users/XinzeChi/repos","events_url":"https://api.github.com/users/XinzeChi/events{/privacy}","received_events_url":"https://api.github.com/users/XinzeChi/received_events","type":"User","site_admin":false},"body":"If there is watcher on this image, the image maybe in use. So reject rename image.\r\nSigned-off-by: Xinze Chi <xmdxcxz@gmail.com>","created_at":"2015-09-02T15:03:30Z","updated_at":"2015-09-10T01:34:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7c31925c0f65ef1a495b74dd3cce353d60570bd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/5777/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/5777/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/5777/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/2d205c152699d66c0b074660f5db97689b4a087e","head":{"label":"XinzeChi:wip-image-mv","ref":"wip-image-mv","sha":"2d205c152699d66c0b074660f5db97689b4a087e","user":{"login":"XinzeChi","id":3147032,"avatar_url":"https://avatars.githubusercontent.com/u/3147032?v=3","gravatar_id":"","url":"https://api.github.com/users/XinzeChi","html_url":"https://github.com/XinzeChi","followers_url":"https://api.github.com/users/XinzeChi/followers","following_url":"https://api.github.com/users/XinzeChi/following{/other_user}","gists_url":"https://api.github.com/users/XinzeChi/gists{/gist_id}","starred_url":"https://api.github.com/users/XinzeChi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XinzeChi/subscriptions","organizations_url":"https://api.github.com/users/XinzeChi/orgs","repos_url":"https://api.github.com/users/XinzeChi/repos","events_url":"https://api.github.com/users/XinzeChi/events{/privacy}","received_events_url":"https://api.github.com/users/XinzeChi/received_events","type":"User","site_admin":false},"repo":{"id":25850756,"name":"ceph","full_name":"XinzeChi/ceph","owner":{"login":"XinzeChi","id":3147032,"avatar_url":"https://avatars.githubusercontent.com/u/3147032?v=3","gravatar_id":"","url":"https://api.github.com/users/XinzeChi","html_url":"https://github.com/XinzeChi","followers_url":"https://api.github.com/users/XinzeChi/followers","following_url":"https://api.github.com/users/XinzeChi/following{/other_user}","gists_url":"https://api.github.com/users/XinzeChi/gists{/gist_id}","starred_url":"https://api.github.com/users/XinzeChi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XinzeChi/subscriptions","organizations_url":"https://api.github.com/users/XinzeChi/orgs","repos_url":"https://api.github.com/users/XinzeChi/repos","events_url":"https://api.github.com/users/XinzeChi/events{/privacy}","received_events_url":"https://api.github.com/users/XinzeChi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/XinzeChi/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/XinzeChi/ceph","forks_url":"https://api.github.com/repos/XinzeChi/ceph/forks","keys_url":"https://api.github.com/repos/XinzeChi/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/XinzeChi/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/XinzeChi/ceph/teams","hooks_url":"https://api.github.com/repos/XinzeChi/ceph/hooks","issue_events_url":"https://api.github.com/repos/XinzeChi/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/XinzeChi/ceph/events","assignees_url":"https://api.github.com/repos/XinzeChi/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/XinzeChi/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/XinzeChi/ceph/tags","blobs_url":"https://api.github.com/repos/XinzeChi/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/XinzeChi/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/XinzeChi/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/XinzeChi/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/XinzeChi/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/XinzeChi/ceph/languages","stargazers_url":"https://api.github.com/repos/XinzeChi/ceph/stargazers","contributors_url":"https://api.github.com/repos/XinzeChi/ceph/contributors","subscribers_url":"https://api.github.com/repos/XinzeChi/ceph/subscribers","subscription_url":"https://api.github.com/repos/XinzeChi/ceph/subscription","commits_url":"https://api.github.com/repos/XinzeChi/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/XinzeChi/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/XinzeChi/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/XinzeChi/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/XinzeChi/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/XinzeChi/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/XinzeChi/ceph/merges","archive_url":"https://api.github.com/repos/XinzeChi/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/XinzeChi/ceph/downloads","issues_url":"https://api.github.com/repos/XinzeChi/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/XinzeChi/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/XinzeChi/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/XinzeChi/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/XinzeChi/ceph/labels{/name}","releases_url":"https://api.github.com/repos/XinzeChi/ceph/releases{/id}","created_at":"2014-10-28T03:06:13Z","updated_at":"2015-05-01T23:44:24Z","pushed_at":"2015-09-09T09:48:43Z","git_url":"git://github.com/XinzeChi/ceph.git","ssh_url":"git@github.com:XinzeChi/ceph.git","clone_url":"https://github.com/XinzeChi/ceph.git","svn_url":"https://github.com/XinzeChi/ceph","homepage":"http://ceph.com","size":134024,"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":"0200403bec45ff153760c0371b6745ad8610867c","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}","created_at":"2011-09-01T21:41:26Z","updated_at":"2015-09-09T21:03:04Z","pushed_at":"2015-09-10T01:31:57Z","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":507910,"stargazers_count":1531,"watchers_count":1531,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":895,"mirror_url":null,"open_issues_count":183,"forks":895,"open_issues":183,"watchers":1531,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5777"},"html":{"href":"https://github.com/ceph/ceph/pull/5777"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/5777"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/5777/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5777/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/5777/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/2d205c152699d66c0b074660f5db97689b4a087e"}}}}