koushik-das commented on a change in pull request #2081: CLOUDSTACK-9894 
Separate creation and backup operations for a volume snapshot
URL: https://github.com/apache/cloudstack/pull/2081#discussion_r125419150
 
 

 ##########
 File path: server/src/com/cloud/vm/UserVmManagerImpl.java
 ##########
 @@ -2655,10 +2656,16 @@ public UserVm destroyVm(DestroyVMCmd cmd) throws 
ResourceUnavailableException, C
         if (expunge && !_accountMgr.isAdmin(ctx.getCallingAccount().getId()) 
&& !AllowUserExpungeRecoverVm.valueIn(cmd.getEntityOwnerId())) {
             throw new PermissionDeniedException("Parameter " + 
ApiConstants.EXPUNGE + " can be passed by Admin only. Or when the 
allow.user.expunge.recover.vm key is set.");
         }
+        // check if VM exists
+        UserVmVO vm = _vmDao.findById(vmId);
 
 Review comment:
   Simply calling findById() doesn't imply VM exists, you need to check that 
the return value is not null.
 
----------------------------------------------------------------
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