Github user alexandrelimassantana commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1491#discussion_r60003773
--- Diff: server/src/com/cloud/user/AccountManagerImpl.java ---
@@ -677,6 +679,17 @@ public boolean deleteAccount(AccountVO account, long
callerUserId, Account calle
return cleanupAccount(account, callerUserId, caller);
}
+ protected List<VolumeVO> getExpungedInstanceRootVolume(long
instanceId) {
+ SearchBuilder<VolumeVO> sb = _volumeDao.createSearchBuilder();
+ sb.and("instanceId", sb.entity().getInstanceId(),
SearchCriteria.Op.EQ);
+ sb.and("vType", sb.entity().getVolumeType(), SearchCriteria.Op.EQ);
+ sb.done();
+ SearchCriteria<VolumeVO> c = sb.create();
+ c.setParameters("instanceId", instanceId);
+ c.setParameters("vType", Volume.Type.ROOT);
+ return _volumeDao.customSearchIncludingRemoved(c, null);
+ }
+
protected boolean cleanupAccount(AccountVO account, long callerUserId,
Account caller) {
--- End diff --
I think it is missing a simple unit tests as a test if the method
expungedInstaceRootVolume is called when the cleanupAccount is invoked and
there is a vm in destroyed state. That and the guarantee that the method
getExpungedInstanceRootVolume works, added to the tests you made would complete
it.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---