{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/76201430","id":76201430,"diff_hunk":"@@ -44,6 +44,19 @@ def save_ems_infra_inventory(ems, hashes, target = nil)\n       return\n     end\n \n+    # Check if a vm was removed and we still have disk(s)\n+    if target.kind_of?(VmOrTemplate) && hashes[:vms].blank?\n+      current = hashes[:vm_disks].collect { |disk| URI(disk[:storage][:ems_ref]).path.split('/').last }.uniq\n+      if current.blank?\n+        storage = nil\n+      else\n+        vm_storages = ([target.storage] + target.storages).compact.uniq\n+        storage = vm_storages.select { |store| !current.include?(store.ems_ref) }\n+      end\n+\n+      target.disconnect_storage storage\n+    end","path":"app/models/ems_refresh/save_inventory_infra.rb","position":15,"original_position":15,"commit_id":"036e704624ecf7b13babbc574c495875de44c2b8","original_commit_id":"92853953b6bf1ba5d47ff8e683215c9fe249d788","user":{"login":"pkliczewski","id":1384786,"avatar_url":"https://avatars.githubusercontent.com/u/1384786?v=3","gravatar_id":"","url":"https://api.github.com/users/pkliczewski","html_url":"https://github.com/pkliczewski","followers_url":"https://api.github.com/users/pkliczewski/followers","following_url":"https://api.github.com/users/pkliczewski/following{/other_user}","gists_url":"https://api.github.com/users/pkliczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkliczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkliczewski/subscriptions","organizations_url":"https://api.github.com/users/pkliczewski/orgs","repos_url":"https://api.github.com/users/pkliczewski/repos","events_url":"https://api.github.com/users/pkliczewski/events{/privacy}","received_events_url":"https://api.github.com/users/pkliczewski/received_events","type":"User","site_admin":false},"body":"@blomquisg As you can see in user_remove_vm_finished.yaml we had this step to run this method. It removes storage which makes vm to be always archived. We should check whether the disks are still there and make a decision whether to remove or not. In the above code I get a list of \"current\" disks and if it is empty I run disconnect_storage as it was or I provide list of storage domains to be removed (if any were not removed).","created_at":"2016-08-25T08:32:53Z","updated_at":"2016-08-25T08:32:53Z","html_url":"https://github.com/ManageIQ/manageiq/pull/10701#discussion_r76201430","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/76201430"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/10701#discussion_r76201430"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701","id":82385364,"html_url":"https://github.com/ManageIQ/manageiq/pull/10701","diff_url":"https://github.com/ManageIQ/manageiq/pull/10701.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/10701.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/10701","number":10701,"state":"open","locked":false,"title":"Targeted refresh improvement for vm removal","user":{"login":"pkliczewski","id":1384786,"avatar_url":"https://avatars.githubusercontent.com/u/1384786?v=3","gravatar_id":"","url":"https://api.github.com/users/pkliczewski","html_url":"https://github.com/pkliczewski","followers_url":"https://api.github.com/users/pkliczewski/followers","following_url":"https://api.github.com/users/pkliczewski/following{/other_user}","gists_url":"https://api.github.com/users/pkliczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkliczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkliczewski/subscriptions","organizations_url":"https://api.github.com/users/pkliczewski/orgs","repos_url":"https://api.github.com/users/pkliczewski/repos","events_url":"https://api.github.com/users/pkliczewski/events{/privacy}","received_events_url":"https://api.github.com/users/pkliczewski/received_events","type":"User","site_admin":false},"body":"This change fixes\r\nhttps://bugzilla.redhat.com/1334949\r\nand improves refresh performance for vm removal events.\r\n\r\nThis change depends on https://github.com/ManageIQ/manageiq/pull/10143\r\n","created_at":"2016-08-23T15:19:30Z","updated_at":"2016-08-25T08:32:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d26d5b4f183fbee3269c76ee89079e0bab2699d","assignee":{"login":"blomquisg","id":14183,"avatar_url":"https://avatars.githubusercontent.com/u/14183?v=3","gravatar_id":"","url":"https://api.github.com/users/blomquisg","html_url":"https://github.com/blomquisg","followers_url":"https://api.github.com/users/blomquisg/followers","following_url":"https://api.github.com/users/blomquisg/following{/other_user}","gists_url":"https://api.github.com/users/blomquisg/gists{/gist_id}","starred_url":"https://api.github.com/users/blomquisg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blomquisg/subscriptions","organizations_url":"https://api.github.com/users/blomquisg/orgs","repos_url":"https://api.github.com/users/blomquisg/repos","events_url":"https://api.github.com/users/blomquisg/events{/privacy}","received_events_url":"https://api.github.com/users/blomquisg/received_events","type":"User","site_admin":false},"assignees":[{"login":"blomquisg","id":14183,"avatar_url":"https://avatars.githubusercontent.com/u/14183?v=3","gravatar_id":"","url":"https://api.github.com/users/blomquisg","html_url":"https://github.com/blomquisg","followers_url":"https://api.github.com/users/blomquisg/followers","following_url":"https://api.github.com/users/blomquisg/following{/other_user}","gists_url":"https://api.github.com/users/blomquisg/gists{/gist_id}","starred_url":"https://api.github.com/users/blomquisg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blomquisg/subscriptions","organizations_url":"https://api.github.com/users/blomquisg/orgs","repos_url":"https://api.github.com/users/blomquisg/repos","events_url":"https://api.github.com/users/blomquisg/events{/privacy}","received_events_url":"https://api.github.com/users/blomquisg/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/10701/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/036e704624ecf7b13babbc574c495875de44c2b8","head":{"label":"pkliczewski:vm_remove_event","ref":"vm_remove_event","sha":"036e704624ecf7b13babbc574c495875de44c2b8","user":{"login":"pkliczewski","id":1384786,"avatar_url":"https://avatars.githubusercontent.com/u/1384786?v=3","gravatar_id":"","url":"https://api.github.com/users/pkliczewski","html_url":"https://github.com/pkliczewski","followers_url":"https://api.github.com/users/pkliczewski/followers","following_url":"https://api.github.com/users/pkliczewski/following{/other_user}","gists_url":"https://api.github.com/users/pkliczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkliczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkliczewski/subscriptions","organizations_url":"https://api.github.com/users/pkliczewski/orgs","repos_url":"https://api.github.com/users/pkliczewski/repos","events_url":"https://api.github.com/users/pkliczewski/events{/privacy}","received_events_url":"https://api.github.com/users/pkliczewski/received_events","type":"User","site_admin":false},"repo":{"id":52615153,"name":"manageiq","full_name":"pkliczewski/manageiq","owner":{"login":"pkliczewski","id":1384786,"avatar_url":"https://avatars.githubusercontent.com/u/1384786?v=3","gravatar_id":"","url":"https://api.github.com/users/pkliczewski","html_url":"https://github.com/pkliczewski","followers_url":"https://api.github.com/users/pkliczewski/followers","following_url":"https://api.github.com/users/pkliczewski/following{/other_user}","gists_url":"https://api.github.com/users/pkliczewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkliczewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkliczewski/subscriptions","organizations_url":"https://api.github.com/users/pkliczewski/orgs","repos_url":"https://api.github.com/users/pkliczewski/repos","events_url":"https://api.github.com/users/pkliczewski/events{/privacy}","received_events_url":"https://api.github.com/users/pkliczewski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pkliczewski/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/pkliczewski/manageiq","forks_url":"https://api.github.com/repos/pkliczewski/manageiq/forks","keys_url":"https://api.github.com/repos/pkliczewski/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pkliczewski/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pkliczewski/manageiq/teams","hooks_url":"https://api.github.com/repos/pkliczewski/manageiq/hooks","issue_events_url":"https://api.github.com/repos/pkliczewski/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/pkliczewski/manageiq/events","assignees_url":"https://api.github.com/repos/pkliczewski/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/pkliczewski/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/pkliczewski/manageiq/tags","blobs_url":"https://api.github.com/repos/pkliczewski/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pkliczewski/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pkliczewski/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/pkliczewski/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pkliczewski/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/pkliczewski/manageiq/languages","stargazers_url":"https://api.github.com/repos/pkliczewski/manageiq/stargazers","contributors_url":"https://api.github.com/repos/pkliczewski/manageiq/contributors","subscribers_url":"https://api.github.com/repos/pkliczewski/manageiq/subscribers","subscription_url":"https://api.github.com/repos/pkliczewski/manageiq/subscription","commits_url":"https://api.github.com/repos/pkliczewski/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/pkliczewski/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/pkliczewski/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/pkliczewski/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/pkliczewski/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/pkliczewski/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pkliczewski/manageiq/merges","archive_url":"https://api.github.com/repos/pkliczewski/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pkliczewski/manageiq/downloads","issues_url":"https://api.github.com/repos/pkliczewski/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/pkliczewski/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/pkliczewski/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/pkliczewski/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pkliczewski/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/pkliczewski/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/pkliczewski/manageiq/deployments","created_at":"2016-02-26T15:55:23Z","updated_at":"2016-02-26T15:55:40Z","pushed_at":"2016-08-24T14:14:52Z","git_url":"git://github.com/pkliczewski/manageiq.git","ssh_url":"git@github.com:pkliczewski/manageiq.git","clone_url":"https://github.com/pkliczewski/manageiq.git","svn_url":"https://github.com/pkliczewski/manageiq","homepage":"manageiq.org","size":150523,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"ManageIQ:master","ref":"master","sha":"fd7242e1bacbd8953066d9d90d4007ae01bd4668","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Open-Source Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2016-08-23T15:59:58Z","pushed_at":"2016-08-25T08:17:30Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":200692,"stargazers_count":307,"watchers_count":307,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":343,"mirror_url":null,"open_issues_count":785,"forks":343,"open_issues":785,"watchers":307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/10701"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/10701"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/10701/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/10701/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/036e704624ecf7b13babbc574c495875de44c2b8"}}}}
{"actor":{"display_login":"pkliczewski"}}