Github user nnesic commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1624#discussion_r78407479 --- 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)) { + // We have to emit the event here because the state listener is ignoring root volume deletions, + // assuming that the UserVMManager is responsible for emitting the usage event for them when --- End diff -- The reason why the delete events for the root volume are not handled by the state listener is that the root volumes don't get destroyed until the VM is expunged. Because of this, if we rely on the state listener to emit the event, the timestamp on the event will not reflect the actual time when the user requested and expects the volume to be destroyed. For now, I would not move the logic for handling these events out of UserVMManager. However, thinking about this again, I agree that it would be better not to scatter this event emitting further. Instead, I am working adding a call to vmMgr.destroy during the cleanup of the account (right now the manager is taking a shortcut, and expunging machines directly). Does that sound better?
--- 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. ---