rhtyd commented on a change in pull request #2793: Destroyvm also removes 
volumes
URL: https://github.com/apache/cloudstack/pull/2793#discussion_r211891096
 
 

 ##########
 File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
 ##########
 @@ -2751,27 +2749,55 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws 
ResourceUnavailableException, C
         // check if VM exists
         UserVmVO vm = _vmDao.findById(vmId);
 
-        if (vm == null) {
+        if (vm == null || vm.getRemoved() != null) {
             throw new InvalidParameterValueException("unable to find a virtual 
machine with id " + vmId);
         }
 
+        if (vm.getState() == State.Destroyed || vm.getState() == 
State.Expunging) {
+            s_logger.trace("Vm id=" + vmId + " is already destroyed");
 
 Review comment:
   Add a s_logger.isTraceEnabled, a debug is also okay

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to