rhtyd commented on a change in pull request #2312: CLOUDSTACK-7793 Create 
Snaphot with quiesce option set to true fails ?
URL: https://github.com/apache/cloudstack/pull/2312#discussion_r152537685
 
 

 ##########
 File path: server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
 ##########
 @@ -603,9 +603,9 @@ private boolean orchestrateDeleteVMSnapshot(Long 
vmSnapshotId) {
 
         _accountMgr.checkAccess(caller, null, true, vmSnapshot);
 
-        // check VM snapshot states, only allow to delete vm snapshots in 
created and error state
-        if (VMSnapshot.State.Ready != vmSnapshot.getState() && 
VMSnapshot.State.Expunging != vmSnapshot.getState() && VMSnapshot.State.Error 
!= vmSnapshot.getState()) {
-            throw new InvalidParameterValueException("Can't delete the vm 
snapshotshot " + vmSnapshotId + " due to it is not in Created or Error, or 
Expunging State");
+        // check VM snapshot states, only allow to delete vm snapshots in 
ready, expunging, allocated and error state
+        if (VMSnapshot.State.Ready != vmSnapshot.getState() && 
VMSnapshot.State.Expunging != vmSnapshot.getState() && VMSnapshot.State.Error 
!= vmSnapshot.getState() && VMSnapshot.State.Allocated != 
vmSnapshot.getState()) {
+            throw new InvalidParameterValueException("Can't delete the vm 
snapshotshot " + vmSnapshotId + " due to it is not in Ready, Error, Allocated 
or Expunging State");
 
 Review comment:
   @yvsubhash can you fix the typo in `snapshotshot`, perhaps consider checking 
if `vmSnapshot.getState()` is in in the list of states, instead of comparing 
against each individually. You may further use that `list` of states in the 
thrown exception.

----------------------------------------------------------------
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