Skip to content

Commit 6569709

Browse files
committed
skip instance with delete protection during account cleanup
1 parent c1af36f commit 6569709

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,12 @@ protected boolean cleanupAccount(AccountVO account, long callerUserId, Account c
10001000
}
10011001

10021002
for (UserVmVO vm : vms) {
1003+
if (vm.isDeleteProtection()) {
1004+
logger.warn("Instance [id = {}, name = {}] has delete protection enabled and cannot be deleted.",
1005+
vm.getUuid(), vm.getName());
1006+
continue;
1007+
}
1008+
10031009
if (vm.getState() != VirtualMachine.State.Destroyed && vm.getState() != VirtualMachine.State.Expunging) {
10041010
try {
10051011
_vmMgr.destroyVm(vm.getId(), false);

0 commit comments

Comments
 (0)