{"action":"created","comment":{"url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/comments/55616875","id":55616875,"diff_hunk":"@@ -334,6 +334,39 @@ def test_migrate_glance_images(self):\n                                                 resource_name='image',\n                                                 parameter='id')\n \n+    @attr(migrated_tenant=['admin', 'tenant1', 'tenant2'])\n+    def test_migrate_deleted_glance_images_only_once(self):\n+        \"\"\"Validate deleted and broken images were migrated to dst only once.\n+        \"\"\"\n+        src_vms = self.src_cloud.novaclient.servers.list(\n+            search_opts={'all_tenants': 1})\n+        src_img_ids = [i.id for i in self.src_cloud.glanceclient.images.list()]\n+        # getting images, from which vms were spawned, but which do not exist\n+        # in the glance\n+        to_restore_img_ids = []\n+        for vm in src_vms:\n+            if vm.image and vm.image['id'] not in src_img_ids:\n+                to_restore_img_ids.append(vm.image['id'])\n+        # getting 'broken' images (which exist in the glance, but deleted in\n+        # storage)\n+        all_images = self.migration_utils.get_all_images_from_config()\n+        broken_images = [i['name'] for i in all_images if i.get('broken')]\n+        src_images = self.src_cloud.glanceclient.images.list()\n+        to_restore_img_ids.extend([image.id for image in src_images\n+                                  if image.name in broken_images])\n+\n+        dst_images = [x for x in self.dst_cloud.glanceclient.images.list()]\n+        restored_dst_images = []\n+        for deleted_img_id in set(to_restore_img_ids):\n+            for dst_image in dst_images:\n+                if dst_image.name and deleted_img_id in dst_image.name:\n+                    restored_dst_images.append(dst_image.name)\n+        duplicated = [i for i in restored_dst_images\n+                      if restored_dst_images.count(i) > 1]\n+        if duplicated:\n+            msg = 'Following images were restored more than 1 time: \"%s\"'","path":"devlab/tests/testcases/test_resource_migration.py","position":34,"original_position":34,"commit_id":"4ac06fe91baaa245c8b57b020c7689551ab1a492","original_commit_id":"4ac06fe91baaa245c8b57b020c7689551ab1a492","user":{"login":"roman-verchikov","id":386276,"avatar_url":"https://avatars.githubusercontent.com/u/386276?v=3","gravatar_id":"","url":"https://api.github.com/users/roman-verchikov","html_url":"https://github.com/roman-verchikov","followers_url":"https://api.github.com/users/roman-verchikov/followers","following_url":"https://api.github.com/users/roman-verchikov/following{/other_user}","gists_url":"https://api.github.com/users/roman-verchikov/gists{/gist_id}","starred_url":"https://api.github.com/users/roman-verchikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roman-verchikov/subscriptions","organizations_url":"https://api.github.com/users/roman-verchikov/orgs","repos_url":"https://api.github.com/users/roman-verchikov/repos","events_url":"https://api.github.com/users/roman-verchikov/events{/privacy}","received_events_url":"https://api.github.com/users/roman-verchikov/received_events","type":"User","site_admin":false},"body":"Would be more readable with number of actual restores, e.g. \"Image X restored N times\"","created_at":"2016-03-10T00:41:04Z","updated_at":"2016-03-10T00:41:04Z","html_url":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893#discussion_r55616875","pull_request_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893","_links":{"self":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/comments/55616875"},"html":{"href":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893#discussion_r55616875"},"pull_request":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893"}}},"pull_request":{"url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893","id":61904471,"html_url":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893","diff_url":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893.diff","patch_url":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893.patch","issue_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/893","number":893,"state":"open","locked":false,"title":"[FT] CF-171 Validate deleted images are restored only once","user":{"login":"ntymtsiv","id":1340083,"avatar_url":"https://avatars.githubusercontent.com/u/1340083?v=3","gravatar_id":"","url":"https://api.github.com/users/ntymtsiv","html_url":"https://github.com/ntymtsiv","followers_url":"https://api.github.com/users/ntymtsiv/followers","following_url":"https://api.github.com/users/ntymtsiv/following{/other_user}","gists_url":"https://api.github.com/users/ntymtsiv/gists{/gist_id}","starred_url":"https://api.github.com/users/ntymtsiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntymtsiv/subscriptions","organizations_url":"https://api.github.com/users/ntymtsiv/orgs","repos_url":"https://api.github.com/users/ntymtsiv/repos","events_url":"https://api.github.com/users/ntymtsiv/events{/privacy}","received_events_url":"https://api.github.com/users/ntymtsiv/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-07T11:24:40Z","updated_at":"2016-03-10T00:41:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3593dab30e66406b255a3558a85abc8e15f347bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893/commits","review_comments_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893/comments","review_comment_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/893/comments","statuses_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/statuses/4ac06fe91baaa245c8b57b020c7689551ab1a492","head":{"label":"ntymtsiv:cf-171","ref":"cf-171","sha":"4ac06fe91baaa245c8b57b020c7689551ab1a492","user":{"login":"ntymtsiv","id":1340083,"avatar_url":"https://avatars.githubusercontent.com/u/1340083?v=3","gravatar_id":"","url":"https://api.github.com/users/ntymtsiv","html_url":"https://github.com/ntymtsiv","followers_url":"https://api.github.com/users/ntymtsiv/followers","following_url":"https://api.github.com/users/ntymtsiv/following{/other_user}","gists_url":"https://api.github.com/users/ntymtsiv/gists{/gist_id}","starred_url":"https://api.github.com/users/ntymtsiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntymtsiv/subscriptions","organizations_url":"https://api.github.com/users/ntymtsiv/orgs","repos_url":"https://api.github.com/users/ntymtsiv/repos","events_url":"https://api.github.com/users/ntymtsiv/events{/privacy}","received_events_url":"https://api.github.com/users/ntymtsiv/received_events","type":"User","site_admin":false},"repo":{"id":38334321,"name":"CloudFerry","full_name":"ntymtsiv/CloudFerry","owner":{"login":"ntymtsiv","id":1340083,"avatar_url":"https://avatars.githubusercontent.com/u/1340083?v=3","gravatar_id":"","url":"https://api.github.com/users/ntymtsiv","html_url":"https://github.com/ntymtsiv","followers_url":"https://api.github.com/users/ntymtsiv/followers","following_url":"https://api.github.com/users/ntymtsiv/following{/other_user}","gists_url":"https://api.github.com/users/ntymtsiv/gists{/gist_id}","starred_url":"https://api.github.com/users/ntymtsiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntymtsiv/subscriptions","organizations_url":"https://api.github.com/users/ntymtsiv/orgs","repos_url":"https://api.github.com/users/ntymtsiv/repos","events_url":"https://api.github.com/users/ntymtsiv/events{/privacy}","received_events_url":"https://api.github.com/users/ntymtsiv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ntymtsiv/CloudFerry","description":"CloudFerry is a cloud virtual workloads migration tool designed and developed by Mirantis Inc. ","fork":true,"url":"https://api.github.com/repos/ntymtsiv/CloudFerry","forks_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/forks","keys_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/teams","hooks_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/hooks","issue_events_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/issues/events{/number}","events_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/events","assignees_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/assignees{/user}","branches_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/branches{/branch}","tags_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/tags","blobs_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/git/refs{/sha}","trees_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/statuses/{sha}","languages_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/languages","stargazers_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/stargazers","contributors_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/contributors","subscribers_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/subscribers","subscription_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/subscription","commits_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/commits{/sha}","git_commits_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/git/commits{/sha}","comments_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/comments{/number}","issue_comment_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/issues/comments{/number}","contents_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/contents/{+path}","compare_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/merges","archive_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/downloads","issues_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/issues{/number}","pulls_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/pulls{/number}","milestones_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/milestones{/number}","notifications_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/labels{/name}","releases_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/releases{/id}","deployments_url":"https://api.github.com/repos/ntymtsiv/CloudFerry/deployments","created_at":"2015-06-30T21:35:13Z","updated_at":"2015-06-30T21:35:14Z","pushed_at":"2016-03-09T13:31:44Z","git_url":"git://github.com/ntymtsiv/CloudFerry.git","ssh_url":"git@github.com:ntymtsiv/CloudFerry.git","clone_url":"https://github.com/ntymtsiv/CloudFerry.git","svn_url":"https://github.com/ntymtsiv/CloudFerry","homepage":null,"size":4082,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"MirantisWorkloadMobility:devel","ref":"devel","sha":"f06102e22b199f71a12b0c0c223b324570f35761","user":{"login":"MirantisWorkloadMobility","id":8500817,"avatar_url":"https://avatars.githubusercontent.com/u/8500817?v=3","gravatar_id":"","url":"https://api.github.com/users/MirantisWorkloadMobility","html_url":"https://github.com/MirantisWorkloadMobility","followers_url":"https://api.github.com/users/MirantisWorkloadMobility/followers","following_url":"https://api.github.com/users/MirantisWorkloadMobility/following{/other_user}","gists_url":"https://api.github.com/users/MirantisWorkloadMobility/gists{/gist_id}","starred_url":"https://api.github.com/users/MirantisWorkloadMobility/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MirantisWorkloadMobility/subscriptions","organizations_url":"https://api.github.com/users/MirantisWorkloadMobility/orgs","repos_url":"https://api.github.com/users/MirantisWorkloadMobility/repos","events_url":"https://api.github.com/users/MirantisWorkloadMobility/events{/privacy}","received_events_url":"https://api.github.com/users/MirantisWorkloadMobility/received_events","type":"User","site_admin":false},"repo":{"id":23142392,"name":"CloudFerry","full_name":"MirantisWorkloadMobility/CloudFerry","owner":{"login":"MirantisWorkloadMobility","id":8500817,"avatar_url":"https://avatars.githubusercontent.com/u/8500817?v=3","gravatar_id":"","url":"https://api.github.com/users/MirantisWorkloadMobility","html_url":"https://github.com/MirantisWorkloadMobility","followers_url":"https://api.github.com/users/MirantisWorkloadMobility/followers","following_url":"https://api.github.com/users/MirantisWorkloadMobility/following{/other_user}","gists_url":"https://api.github.com/users/MirantisWorkloadMobility/gists{/gist_id}","starred_url":"https://api.github.com/users/MirantisWorkloadMobility/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MirantisWorkloadMobility/subscriptions","organizations_url":"https://api.github.com/users/MirantisWorkloadMobility/orgs","repos_url":"https://api.github.com/users/MirantisWorkloadMobility/repos","events_url":"https://api.github.com/users/MirantisWorkloadMobility/events{/privacy}","received_events_url":"https://api.github.com/users/MirantisWorkloadMobility/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MirantisWorkloadMobility/CloudFerry","description":"\"CloudFerry Framework\" is a cloud virtual workloads migration framework designed and developed by Mirantis Inc. ","fork":false,"url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry","forks_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/forks","keys_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/teams","hooks_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/hooks","issue_events_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/events{/number}","events_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/events","assignees_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/assignees{/user}","branches_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/branches{/branch}","tags_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/tags","blobs_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/git/refs{/sha}","trees_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/statuses/{sha}","languages_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/languages","stargazers_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/stargazers","contributors_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/contributors","subscribers_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/subscribers","subscription_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/subscription","commits_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/commits{/sha}","git_commits_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/git/commits{/sha}","comments_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/comments{/number}","issue_comment_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/comments{/number}","contents_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/contents/{+path}","compare_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/merges","archive_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/downloads","issues_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues{/number}","pulls_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls{/number}","milestones_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/milestones{/number}","notifications_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/labels{/name}","releases_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/releases{/id}","deployments_url":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/deployments","created_at":"2014-08-20T09:00:38Z","updated_at":"2016-03-02T10:20:17Z","pushed_at":"2016-03-10T00:07:20Z","git_url":"git://github.com/MirantisWorkloadMobility/CloudFerry.git","ssh_url":"git@github.com:MirantisWorkloadMobility/CloudFerry.git","clone_url":"https://github.com/MirantisWorkloadMobility/CloudFerry.git","svn_url":"https://github.com/MirantisWorkloadMobility/CloudFerry","homepage":"","size":4888,"stargazers_count":17,"watchers_count":17,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":14,"forks":38,"open_issues":14,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893"},"html":{"href":"https://github.com/MirantisWorkloadMobility/CloudFerry/pull/893"},"issue":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/893"},"comments":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/issues/893/comments"},"review_comments":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893/comments"},"review_comment":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/pulls/893/commits"},"statuses":{"href":"https://api.github.com/repos/MirantisWorkloadMobility/CloudFerry/statuses/4ac06fe91baaa245c8b57b020c7689551ab1a492"}}}}