Skip to content

Commit ed6e3be

Browse files
subhash yedugundlayadvr
authored andcommitted
CLOUDSTACK-7793: Create Snaphot with quiesce option set to true fails with InvalidParameterValueException (#2312)
reate Snaphot with quiesce option set to true fails with InvalidParameterValueException --quiescevm option is only supported with netapp plugin with vmware. When netapp is not there, they would be struck in Allocated state and Deletion is not supported in allocated state. To fix this issue, deletion is supported in allocated state as well.
1 parent 8f35657 commit ed6e3be

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.cloud.vm.snapshot;
1919

2020
import java.util.ArrayList;
21+
import java.util.Arrays;
2122
import java.util.Date;
2223
import java.util.HashMap;
2324
import java.util.List;
@@ -603,9 +604,10 @@ private boolean orchestrateDeleteVMSnapshot(Long vmSnapshotId) {
603604

604605
_accountMgr.checkAccess(caller, null, true, vmSnapshot);
605606

606-
// check VM snapshot states, only allow to delete vm snapshots in created and error state
607-
if (VMSnapshot.State.Ready != vmSnapshot.getState() && VMSnapshot.State.Expunging != vmSnapshot.getState() && VMSnapshot.State.Error != vmSnapshot.getState()) {
608-
throw new InvalidParameterValueException("Can't delete the vm snapshotshot " + vmSnapshotId + " due to it is not in Created or Error, or Expunging State");
607+
List<VMSnapshot.State> validStates = Arrays.asList(VMSnapshot.State.Ready, VMSnapshot.State.Expunging, VMSnapshot.State.Error, VMSnapshot.State.Allocated);
608+
// check VM snapshot states, only allow to delete vm snapshots in ready, expunging, allocated and error state
609+
if (!validStates.contains(vmSnapshot.getState())) {
610+
throw new InvalidParameterValueException("Can't delete the vm snapshot " + vmSnapshotId + " due to it is not in " + validStates.toString() + "States");
609611
}
610612

611613
// check if there are other active VM snapshot tasks

0 commit comments

Comments
 (0)