Alena Prokharchyk created CLOUDSTACK-4465:
---------------------------------------------

             Summary: Resource count is not decremented for domain if User Vm 
is being destroyed as a part of account removal
                 Key: CLOUDSTACK-4465
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4465
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
          Components: Management Server
    Affects Versions: 4.2.0
            Reporter: Alena Prokharchyk
            Assignee: Alena Prokharchyk
            Priority: Critical
             Fix For: 4.2.1


Steps to reproduce: 
======================== 
1) create an account 
2) Deploy a vm for the account 
3) Delete the account. 

Bug: the user_vm resource count for the account's domain is not being 
decremented. 


 Decrement for resource 
count happens as a part of UserVmManagerImpl.DestroyVm method. But when account 
is being removed, for all his vms the expunge method is being called omitting 
the destroyVm call: 

 // no need to catch exception at this place as expunging vm should pass in 
order to perform further cleanup 
            for (UserVmVO vm : vms) { 
                if (!_vmMgr.expunge(vm, callerUserId, caller)) { 
                    s_logger.error("Unable to expunge vm: " + vm.getId()); 
                    accountCleanupNeeded = true; 
                } 
            } 


The fix would be - call destroy before performing the expunge call: 

            for (UserVmVO vm : vms) { 
                //Destroy vm first so it goes through correct cleanup process 
                _vmMgr.destroyVm(vm.getId()); 
                //Now expunge the vm 
                if (!_vmMgr.expunge(vm, callerUserId, caller)) { 
                    s_logger.error("Unable to expunge vm: " + vm.getId()); 
                    accountCleanupNeeded = true; 
                } 
            } 


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to