Do not allow deletion of the snapshot if the snapshot is being copied

This commit is contained in:
Mike Tutkowski 2015-01-26 09:15:56 -07:00
parent abf4e5c646
commit c847831662
1 changed files with 5 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotResult;
@ -117,6 +118,10 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
return true;
}
if (ObjectInDataStoreStateMachine.State.Copying.equals(snapshotObj.getStatus())) {
throw new InvalidParameterValueException("Unable to delete snapshotshot " + snapshotId + " because it is in the copying state.");
}
try {
snapshotObj.processEvent(Snapshot.Event.DestroyRequested);
}