{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/57230878","id":57230878,"diff_hunk":"@@ -2872,6 +2872,55 @@ int validate_mirroring_enabled(ImageCtx *ictx) {\n             << cpp_strerror(r) << dendl;\n         }\n       }\n+    } else if (next_mirror_mode == cls::rbd::MIRROR_MODE_DISABLED) {\n+\n+      bool needs_rollback = false;\n+      if (current_mirror_mode == cls::rbd::MIRROR_MODE_POOL) {\n+        r = cls_client::mirror_mode_set(&io_ctx, cls::rbd::MIRROR_MODE_IMAGE);\n+        if (r < 0) {\n+          lderr(cct) << \"Failed to set mirror mode to image: \"\n+            << cpp_strerror(r) << dendl;\n+          return r;\n+        }\n+        needs_rollback = true;\n+      }\n+\n+      std::vector<std::string> image_ids;\n+      r = cls_client::mirror_image_list(&io_ctx, &image_ids);\n+      if (r < 0) {\n+        lderr(cct) << \"Failed listing images: \" << cpp_strerror(r) << dendl;\n+        if (needs_rollback) {\n+          r = cls_client::mirror_mode_set(&io_ctx, current_mirror_mode);\n+          if (r < 0) {\n+            lderr(cct) << \"Failed to rollback mirror mode: \" << cpp_strerror(r)\n+              << dendl;\n+          }\n+        }\n+        return r;\n+      }\n+\n+      for (const auto& img_id : image_ids) {\n+        ImageCtx *img_ctx = new ImageCtx(\"\", img_id, nullptr, io_ctx, false);\n+        r = img_ctx->state->open();\n+        if (r < 0) {\n+          lderr(cct) << \"error opening image id \"<< img_id << \": \"\n+            << cpp_strerror(r) << dendl;\n+          delete img_ctx;\n+          continue;","path":"src/librbd/internal.cc","position":169,"original_position":38,"commit_id":"da6192d36bd554d862df50ac9a4658c0c95be7ee","original_commit_id":"9775c3767432eac9c238d2c3c07a4285a690134e","user":{"login":"dillaman","id":4739042,"avatar_url":"https://avatars.githubusercontent.com/u/4739042?v=3","gravatar_id":"","url":"https://api.github.com/users/dillaman","html_url":"https://github.com/dillaman","followers_url":"https://api.github.com/users/dillaman/followers","following_url":"https://api.github.com/users/dillaman/following{/other_user}","gists_url":"https://api.github.com/users/dillaman/gists{/gist_id}","starred_url":"https://api.github.com/users/dillaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dillaman/subscriptions","organizations_url":"https://api.github.com/users/dillaman/orgs","repos_url":"https://api.github.com/users/dillaman/repos","events_url":"https://api.github.com/users/dillaman/events{/privacy}","received_events_url":"https://api.github.com/users/dillaman/received_events","type":"User","site_admin":false},"body":"I think if you have any error disabling mirroring on an image you just need to abort -- don't want to leave the pool / images in an inconsistent state.  Same comment below.","created_at":"2016-03-23T20:28:28Z","updated_at":"2016-03-23T20:28:28Z","html_url":"https://github.com/ceph/ceph/pull/8261#discussion_r57230878","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/8261","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/57230878"},"html":{"href":"https://github.com/ceph/ceph/pull/8261#discussion_r57230878"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/8261"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/8261","id":63733691,"html_url":"https://github.com/ceph/ceph/pull/8261","diff_url":"https://github.com/ceph/ceph/pull/8261.diff","patch_url":"https://github.com/ceph/ceph/pull/8261.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/8261","number":8261,"state":"open","locked":false,"title":"rbd-mirror: Enabling/disabling pool-level mirroring interacts with image mirroring","user":{"login":"rjfd","id":17119885,"avatar_url":"https://avatars.githubusercontent.com/u/17119885?v=3","gravatar_id":"","url":"https://api.github.com/users/rjfd","html_url":"https://github.com/rjfd","followers_url":"https://api.github.com/users/rjfd/followers","following_url":"https://api.github.com/users/rjfd/following{/other_user}","gists_url":"https://api.github.com/users/rjfd/gists{/gist_id}","starred_url":"https://api.github.com/users/rjfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjfd/subscriptions","organizations_url":"https://api.github.com/users/rjfd/orgs","repos_url":"https://api.github.com/users/rjfd/repos","events_url":"https://api.github.com/users/rjfd/events{/privacy}","received_events_url":"https://api.github.com/users/rjfd/received_events","type":"User","site_admin":false},"body":"Fixes #15217\r\n\r\nTicket url: http://tracker.ceph.com/issues/15217","created_at":"2016-03-22T14:57:05Z","updated_at":"2016-03-23T20:28:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"635995279ce52a96247ab2e36a99afbe02103392","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/8261/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/8261/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/8261/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/da6192d36bd554d862df50ac9a4658c0c95be7ee","head":{"label":"rjfd:wip-15217","ref":"wip-15217","sha":"da6192d36bd554d862df50ac9a4658c0c95be7ee","user":{"login":"rjfd","id":17119885,"avatar_url":"https://avatars.githubusercontent.com/u/17119885?v=3","gravatar_id":"","url":"https://api.github.com/users/rjfd","html_url":"https://github.com/rjfd","followers_url":"https://api.github.com/users/rjfd/followers","following_url":"https://api.github.com/users/rjfd/following{/other_user}","gists_url":"https://api.github.com/users/rjfd/gists{/gist_id}","starred_url":"https://api.github.com/users/rjfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjfd/subscriptions","organizations_url":"https://api.github.com/users/rjfd/orgs","repos_url":"https://api.github.com/users/rjfd/repos","events_url":"https://api.github.com/users/rjfd/events{/privacy}","received_events_url":"https://api.github.com/users/rjfd/received_events","type":"User","site_admin":false},"repo":{"id":51286925,"name":"ceph","full_name":"rjfd/ceph","owner":{"login":"rjfd","id":17119885,"avatar_url":"https://avatars.githubusercontent.com/u/17119885?v=3","gravatar_id":"","url":"https://api.github.com/users/rjfd","html_url":"https://github.com/rjfd","followers_url":"https://api.github.com/users/rjfd/followers","following_url":"https://api.github.com/users/rjfd/following{/other_user}","gists_url":"https://api.github.com/users/rjfd/gists{/gist_id}","starred_url":"https://api.github.com/users/rjfd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjfd/subscriptions","organizations_url":"https://api.github.com/users/rjfd/orgs","repos_url":"https://api.github.com/users/rjfd/repos","events_url":"https://api.github.com/users/rjfd/events{/privacy}","received_events_url":"https://api.github.com/users/rjfd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjfd/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/rjfd/ceph","forks_url":"https://api.github.com/repos/rjfd/ceph/forks","keys_url":"https://api.github.com/repos/rjfd/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjfd/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjfd/ceph/teams","hooks_url":"https://api.github.com/repos/rjfd/ceph/hooks","issue_events_url":"https://api.github.com/repos/rjfd/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/rjfd/ceph/events","assignees_url":"https://api.github.com/repos/rjfd/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/rjfd/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/rjfd/ceph/tags","blobs_url":"https://api.github.com/repos/rjfd/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjfd/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjfd/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjfd/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjfd/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/rjfd/ceph/languages","stargazers_url":"https://api.github.com/repos/rjfd/ceph/stargazers","contributors_url":"https://api.github.com/repos/rjfd/ceph/contributors","subscribers_url":"https://api.github.com/repos/rjfd/ceph/subscribers","subscription_url":"https://api.github.com/repos/rjfd/ceph/subscription","commits_url":"https://api.github.com/repos/rjfd/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjfd/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjfd/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjfd/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjfd/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/rjfd/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjfd/ceph/merges","archive_url":"https://api.github.com/repos/rjfd/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjfd/ceph/downloads","issues_url":"https://api.github.com/repos/rjfd/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/rjfd/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/rjfd/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/rjfd/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjfd/ceph/labels{/name}","releases_url":"https://api.github.com/repos/rjfd/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/rjfd/ceph/deployments","created_at":"2016-02-08T08:44:21Z","updated_at":"2016-02-08T08:44:38Z","pushed_at":"2016-03-23T17:08:49Z","git_url":"git://github.com/rjfd/ceph.git","ssh_url":"git@github.com:rjfd/ceph.git","clone_url":"https://github.com/rjfd/ceph.git","svn_url":"https://github.com/rjfd/ceph","homepage":"http://ceph.com","size":166910,"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":"71cfaf244e0aa269167d3b618091194e0343fee8","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-23T16:11:51Z","pushed_at":"2016-03-23T19:38:11Z","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":208550,"stargazers_count":1977,"watchers_count":1977,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1201,"mirror_url":null,"open_issues_count":289,"forks":1201,"open_issues":289,"watchers":1977,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/8261"},"html":{"href":"https://github.com/ceph/ceph/pull/8261"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/8261"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/8261/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/8261/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/8261/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/da6192d36bd554d862df50ac9a4658c0c95be7ee"}}}}