Github user nnesic commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1491#discussion_r59707938 --- Diff: server/src/com/cloud/user/AccountManagerImpl.java --- @@ -761,6 +774,17 @@ protected boolean cleanupAccount(AccountVO account, long callerUserId, Account c s_logger.error("Unable to expunge vm: " + vm.getId()); accountCleanupNeeded = true; } + else if (!vm.getState().equals(VirtualMachine.State.Destroyed)) { --- End diff -- The check on line 777 makes sure that the volume wasn't already destroyed before expunging. In that case, the delete event has already been emitted somewhere else. The expunge thread does emit other usage events correctly (we tested deleting an account having active VMs, datadisks, allocated IP's, templates, and snapshots, and upon deleting the account, "delete" usage events were emitted for each of them). The emission of the ROOT volume's "delete" event is handled on a more case-by-case basis (In UserVmManager for regular VM destroys, in VolumeOrchestrator for failed vm creation, etc), and the case where the root volume gets deleted as part of account deletion was not being handled.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---