Repository: cloudstack Updated Branches: refs/heads/master abf4e5c64 -> c84783166
Do not allow deletion of the snapshot if the snapshot is being copied Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c8478316 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c8478316 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c8478316 Branch: refs/heads/master Commit: c8478316624e334749a91a975d08ed035a9293ed Parents: abf4e5c Author: Mike Tutkowski <[email protected]> Authored: Mon Jan 26 09:15:56 2015 -0700 Committer: Mike Tutkowski <[email protected]> Committed: Mon Jan 26 14:57:28 2015 -0700 ---------------------------------------------------------------------- .../storage/snapshot/StorageSystemSnapshotStrategy.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8478316/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java index c4946ab..90c7244 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java @@ -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); }
