sureshanaparti commented on a change in pull request #4859:
URL: https://github.com/apache/cloudstack/pull/4859#discussion_r610533407



##########
File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
##########
@@ -1994,6 +1997,10 @@ private void validateRootVolumeDetachAttach(VolumeVO 
volume, UserVmVO vm) {
 
     @ActionEvent(eventType = EventTypes.EVENT_VOLUME_DETACH, eventDescription 
= "detaching volume")
     public Volume detachVolumeViaDestroyVM(long vmId, long volumeId) {
+        Account caller = CallContext.current().getCallingAccount();
+        Volume volume = _volsDao.findById(volumeId);
+        // Permissions check
+        _accountMgr.checkAccess(caller, null, true, volume);

Review comment:
       @lujiefsi VM destroy might fail if the caller cannot access any 
volume(s) attached to VM. So, I think it is better to check the access before 
destroying VM.




-- 
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:
[email protected]


Reply via email to