{"action":"created","comment":{"url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/comments/206626401","pull_request_review_id":142074786,"id":206626401,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjYyNjQwMQ==","diff_hunk":"@@ -2751,24 +2749,47 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, C\n         // check if VM exists\n         UserVmVO vm = _vmDao.findById(vmId);\n \n-        if (vm == null) {\n+        if (vm == null || vm.getRemoved() != null) {\n             throw new InvalidParameterValueException(\"unable to find a virtual machine with id \" + vmId);\n         }\n \n+        if (vm.getState() == State.Destroyed || vm.getState() == State.Expunging) {\n+            s_logger.trace(\"Vm id=\" + vmId + \" is already destroyed\");\n+            return vm;\n+        }\n+\n         // check if there are active volume snapshots tasks\n         s_logger.debug(\"Checking if there are any ongoing snapshots on the ROOT volumes associated with VM with ID \" + vmId);\n         if (checkStatusOfVolumeSnapshots(vmId, Volume.Type.ROOT)) {\n             throw new CloudRuntimeException(\"There is/are unbacked up snapshot(s) on ROOT volume, vm destroy is not permitted, please try again later.\");\n         }\n         s_logger.debug(\"Found no ongoing snapshots on volume of type ROOT, for the vm with id \" + vmId);\n \n+        List<VolumeVO> volumes = new ArrayList<>();\n+\n+        if (cmd.getVolumeIds() != null) {\n+            for (Long volId : cmd.getVolumeIds()) {\n+                VolumeVO vol = _volsDao.findById(volId);\n+\n+                if (vol == null) {\n+                    throw new InvalidParameterValueException(\"Unable to find volume with ID: \" + volId);\n+                }\n+                volumes.add(vol);\n+            }\n+        }\n+\n+        checkForUnattachedVolumes(vmId, volumes);\n+        validateVolumes(volumes);\n+","path":"server/src/main/java/com/cloud/vm/UserVmManagerImpl.java","position":208,"original_position":208,"commit_id":"83ae447dc73ce07dfdc4b786d2659d7fcc6c0eeb","original_commit_id":"83ae447dc73ce07dfdc4b786d2659d7fcc6c0eeb","user":{"login":"DaanHoogland","id":2486961,"node_id":"MDQ6VXNlcjI0ODY5NjE=","avatar_url":"https://avatars1.githubusercontent.com/u/2486961?v=4","gravatar_id":"","url":"https://api.github.com/users/DaanHoogland","html_url":"https://github.com/DaanHoogland","followers_url":"https://api.github.com/users/DaanHoogland/followers","following_url":"https://api.github.com/users/DaanHoogland/following{/other_user}","gists_url":"https://api.github.com/users/DaanHoogland/gists{/gist_id}","starred_url":"https://api.github.com/users/DaanHoogland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaanHoogland/subscriptions","organizations_url":"https://api.github.com/users/DaanHoogland/orgs","repos_url":"https://api.github.com/users/DaanHoogland/repos","events_url":"https://api.github.com/users/DaanHoogland/events{/privacy}","received_events_url":"https://api.github.com/users/DaanHoogland/received_events","type":"User","site_admin":false},"body":"detach here","created_at":"2018-07-31T17:58:08Z","updated_at":"2018-07-31T17:58:08Z","html_url":"https://github.com/shapeblue/cloudstack/pull/18#discussion_r206626401","pull_request_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/comments/206626401"},"html":{"href":"https://github.com/shapeblue/cloudstack/pull/18#discussion_r206626401"},"pull_request":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18","id":203505265,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNTA1MjY1","html_url":"https://github.com/shapeblue/cloudstack/pull/18","diff_url":"https://github.com/shapeblue/cloudstack/pull/18.diff","patch_url":"https://github.com/shapeblue/cloudstack/pull/18.patch","issue_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/18","number":18,"state":"open","locked":false,"title":"Destroyvm also removes volumes","user":{"login":"houthuis","id":5709175,"node_id":"MDQ6VXNlcjU3MDkxNzU=","avatar_url":"https://avatars3.githubusercontent.com/u/5709175?v=4","gravatar_id":"","url":"https://api.github.com/users/houthuis","html_url":"https://github.com/houthuis","followers_url":"https://api.github.com/users/houthuis/followers","following_url":"https://api.github.com/users/houthuis/following{/other_user}","gists_url":"https://api.github.com/users/houthuis/gists{/gist_id}","starred_url":"https://api.github.com/users/houthuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houthuis/subscriptions","organizations_url":"https://api.github.com/users/houthuis/orgs","repos_url":"https://api.github.com/users/houthuis/repos","events_url":"https://api.github.com/users/houthuis/events{/privacy}","received_events_url":"https://api.github.com/users/houthuis/received_events","type":"User","site_admin":false},"body":"## Description\r\nTBC\r\n<!--- Describe your changes in detail -->\r\n\r\n<!-- For new features, provide link to FS, dev ML discussion etc. -->\r\n<!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [ ] Enhancement (improves an existing feature and functionality)\r\n- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)\r\n\r\n## GitHub Issue/PRs\r\n<!-- If this PR is to fix an issue or another PR on GH, uncomment the section and provide the id of issue/PR -->\r\n<!-- When \"Fixes: #<id>\" is specified, the issue/PR will automatically be closed when this PR gets merged -->\r\n<!-- For addressing multiple issues/PRs, use multiple \"Fixes: #<id>\" -->\r\n\r\n<!-- Fixes: # -->\r\n\r\n## Screenshots (if appropriate):\r\n\r\n## How Has This Been Tested?\r\n\r\n<!-- Please describe in detail how you tested your changes. -->\r\n<!-- Include details of your testing environment, and the tests you ran to -->\r\n<!-- see how your change affects other areas of the code, etc. -->\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [ ] I have read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document.\r\n- [ ] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\nTesting\r\n- [ ] I have added tests to cover my changes.\r\n- [ ] All relevant new and existing integration tests have passed.\r\n- [ ] A full integration testsuite with all test that can run on my environment has passed.\r\n\r\n","created_at":"2018-07-24T12:11:07Z","updated_at":"2018-07-31T17:58:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b269cc5d0e6cb6d8682929fb00b5abb848642584","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18/commits","review_comments_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18/comments","review_comment_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/18/comments","statuses_url":"https://api.github.com/repos/shapeblue/cloudstack/statuses/83ae447dc73ce07dfdc4b786d2659d7fcc6c0eeb","head":{"label":"shapeblue:destroyvm-also-removes-volumes","ref":"destroyvm-also-removes-volumes","sha":"83ae447dc73ce07dfdc4b786d2659d7fcc6c0eeb","user":{"login":"shapeblue","id":6001764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMDE3NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6001764?v=4","gravatar_id":"","url":"https://api.github.com/users/shapeblue","html_url":"https://github.com/shapeblue","followers_url":"https://api.github.com/users/shapeblue/followers","following_url":"https://api.github.com/users/shapeblue/following{/other_user}","gists_url":"https://api.github.com/users/shapeblue/gists{/gist_id}","starred_url":"https://api.github.com/users/shapeblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapeblue/subscriptions","organizations_url":"https://api.github.com/users/shapeblue/orgs","repos_url":"https://api.github.com/users/shapeblue/repos","events_url":"https://api.github.com/users/shapeblue/events{/privacy}","received_events_url":"https://api.github.com/users/shapeblue/received_events","type":"Organization","site_admin":false},"repo":{"id":35481491,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ4MTQ5MQ==","name":"cloudstack","full_name":"shapeblue/cloudstack","owner":{"login":"shapeblue","id":6001764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMDE3NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6001764?v=4","gravatar_id":"","url":"https://api.github.com/users/shapeblue","html_url":"https://github.com/shapeblue","followers_url":"https://api.github.com/users/shapeblue/followers","following_url":"https://api.github.com/users/shapeblue/following{/other_user}","gists_url":"https://api.github.com/users/shapeblue/gists{/gist_id}","starred_url":"https://api.github.com/users/shapeblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapeblue/subscriptions","organizations_url":"https://api.github.com/users/shapeblue/orgs","repos_url":"https://api.github.com/users/shapeblue/repos","events_url":"https://api.github.com/users/shapeblue/events{/privacy}","received_events_url":"https://api.github.com/users/shapeblue/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shapeblue/cloudstack","description":"The upstream repository is at http://github.com/apache/cloudstack. This is ShapeBlue's support/patch branches and Apache CloudStack™ backup","fork":true,"url":"https://api.github.com/repos/shapeblue/cloudstack","forks_url":"https://api.github.com/repos/shapeblue/cloudstack/forks","keys_url":"https://api.github.com/repos/shapeblue/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shapeblue/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shapeblue/cloudstack/teams","hooks_url":"https://api.github.com/repos/shapeblue/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/shapeblue/cloudstack/events","assignees_url":"https://api.github.com/repos/shapeblue/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/shapeblue/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/shapeblue/cloudstack/tags","blobs_url":"https://api.github.com/repos/shapeblue/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shapeblue/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shapeblue/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/shapeblue/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shapeblue/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/shapeblue/cloudstack/languages","stargazers_url":"https://api.github.com/repos/shapeblue/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/shapeblue/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/shapeblue/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/shapeblue/cloudstack/subscription","commits_url":"https://api.github.com/repos/shapeblue/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/shapeblue/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/shapeblue/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/shapeblue/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/shapeblue/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shapeblue/cloudstack/merges","archive_url":"https://api.github.com/repos/shapeblue/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shapeblue/cloudstack/downloads","issues_url":"https://api.github.com/repos/shapeblue/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/shapeblue/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/shapeblue/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shapeblue/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/shapeblue/cloudstack/releases{/id}","deployments_url":"https://api.github.com/repos/shapeblue/cloudstack/deployments","created_at":"2015-05-12T10:22:21Z","updated_at":"2018-07-26T07:46:13Z","pushed_at":"2018-07-31T16:41:34Z","git_url":"git://github.com/shapeblue/cloudstack.git","ssh_url":"git@github.com:shapeblue/cloudstack.git","clone_url":"https://github.com/shapeblue/cloudstack.git","svn_url":"https://github.com/shapeblue/cloudstack","homepage":"http://shapeblue.com/packages","size":540053,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"shapeblue:master","ref":"master","sha":"c8a980b9cfd1361633d1e48a087c23cca3b8a261","user":{"login":"shapeblue","id":6001764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMDE3NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6001764?v=4","gravatar_id":"","url":"https://api.github.com/users/shapeblue","html_url":"https://github.com/shapeblue","followers_url":"https://api.github.com/users/shapeblue/followers","following_url":"https://api.github.com/users/shapeblue/following{/other_user}","gists_url":"https://api.github.com/users/shapeblue/gists{/gist_id}","starred_url":"https://api.github.com/users/shapeblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapeblue/subscriptions","organizations_url":"https://api.github.com/users/shapeblue/orgs","repos_url":"https://api.github.com/users/shapeblue/repos","events_url":"https://api.github.com/users/shapeblue/events{/privacy}","received_events_url":"https://api.github.com/users/shapeblue/received_events","type":"Organization","site_admin":false},"repo":{"id":35481491,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ4MTQ5MQ==","name":"cloudstack","full_name":"shapeblue/cloudstack","owner":{"login":"shapeblue","id":6001764,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYwMDE3NjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6001764?v=4","gravatar_id":"","url":"https://api.github.com/users/shapeblue","html_url":"https://github.com/shapeblue","followers_url":"https://api.github.com/users/shapeblue/followers","following_url":"https://api.github.com/users/shapeblue/following{/other_user}","gists_url":"https://api.github.com/users/shapeblue/gists{/gist_id}","starred_url":"https://api.github.com/users/shapeblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shapeblue/subscriptions","organizations_url":"https://api.github.com/users/shapeblue/orgs","repos_url":"https://api.github.com/users/shapeblue/repos","events_url":"https://api.github.com/users/shapeblue/events{/privacy}","received_events_url":"https://api.github.com/users/shapeblue/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shapeblue/cloudstack","description":"The upstream repository is at http://github.com/apache/cloudstack. This is ShapeBlue's support/patch branches and Apache CloudStack™ backup","fork":true,"url":"https://api.github.com/repos/shapeblue/cloudstack","forks_url":"https://api.github.com/repos/shapeblue/cloudstack/forks","keys_url":"https://api.github.com/repos/shapeblue/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shapeblue/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shapeblue/cloudstack/teams","hooks_url":"https://api.github.com/repos/shapeblue/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/shapeblue/cloudstack/events","assignees_url":"https://api.github.com/repos/shapeblue/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/shapeblue/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/shapeblue/cloudstack/tags","blobs_url":"https://api.github.com/repos/shapeblue/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shapeblue/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shapeblue/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/shapeblue/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shapeblue/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/shapeblue/cloudstack/languages","stargazers_url":"https://api.github.com/repos/shapeblue/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/shapeblue/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/shapeblue/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/shapeblue/cloudstack/subscription","commits_url":"https://api.github.com/repos/shapeblue/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/shapeblue/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/shapeblue/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/shapeblue/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/shapeblue/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/shapeblue/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shapeblue/cloudstack/merges","archive_url":"https://api.github.com/repos/shapeblue/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shapeblue/cloudstack/downloads","issues_url":"https://api.github.com/repos/shapeblue/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/shapeblue/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/shapeblue/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/shapeblue/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shapeblue/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/shapeblue/cloudstack/releases{/id}","deployments_url":"https://api.github.com/repos/shapeblue/cloudstack/deployments","created_at":"2015-05-12T10:22:21Z","updated_at":"2018-07-26T07:46:13Z","pushed_at":"2018-07-31T16:41:34Z","git_url":"git://github.com/shapeblue/cloudstack.git","ssh_url":"git@github.com:shapeblue/cloudstack.git","clone_url":"https://github.com/shapeblue/cloudstack.git","svn_url":"https://github.com/shapeblue/cloudstack","homepage":"http://shapeblue.com/packages","size":540053,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18"},"html":{"href":"https://github.com/shapeblue/cloudstack/pull/18"},"issue":{"href":"https://api.github.com/repos/shapeblue/cloudstack/issues/18"},"comments":{"href":"https://api.github.com/repos/shapeblue/cloudstack/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shapeblue/cloudstack/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/shapeblue/cloudstack/statuses/83ae447dc73ce07dfdc4b786d2659d7fcc6c0eeb"}},"author_association":"NONE"}}
{"actor":{"display_login":"DaanHoogland"}}