You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/02/01 11:35:34 UTC

[GitHub] [cloudstack] ravening commented on a change in pull request #4617: Provide option to force delete the project

ravening commented on a change in pull request #4617:
URL: https://github.com/apache/cloudstack/pull/4617#discussion_r567756138



##########
File path: server/src/main/java/com/cloud/projects/ProjectManagerImpl.java
##########
@@ -313,7 +338,29 @@ public boolean deleteProject(long projectId) {
         CallContext.current().setProject(project);
         _accountMgr.checkAccess(ctx.getCallingAccount(), AccessType.ModifyProject, true, _accountMgr.getAccount(project.getProjectAccountId()));
 
-        return deleteProject(ctx.getCallingAccount(), ctx.getCallingUserId(), project);
+        if (isCleanup != null && isCleanup) {
+            return deleteProject(ctx.getCallingAccount(), ctx.getCallingUserId(), project);
+        } else {
+            List<VMTemplateVO> userTemplates = _templateDao.listByAccountId(project.getProjectAccountId());
+            List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.listByAccountId(project.getProjectAccountId());
+            List<UserVmVO> vms = _userVmDao.listByAccountId(project.getProjectAccountId());
+            List<VolumeVO> volumes = _volumeDao.findDetachedByAccount(project.getProjectAccountId());
+            List<NetworkVO> networks = _networkDao.listByOwner(project.getProjectAccountId());
+            List<? extends Vpc> vpcs = _vpcMgr.getVpcsForAccount(project.getProjectAccountId());
+
+            Optional<String> message = Stream.of(userTemplates, vmSnapshots, vms, volumes, networks, vpcs)

Review comment:
       @Pearl1594 I can do that 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org