CLOUDSTACK-2932: Allow deleting of snapshots that have errored out. Simply mark the removed column as there is no physical clean up required. It can land into error state only from allocated/Creating state which are states before creation on primary storage works
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/86cada3b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/86cada3b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/86cada3b Branch: refs/heads/rbac Commit: 86cada3b3c1871c45bd206c07f785bf499865d61 Parents: e51d472 Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Wed Feb 5 17:34:48 2014 -0800 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Wed Feb 5 17:34:48 2014 -0800 ---------------------------------------------------------------------- .../cloudstack/storage/snapshot/XenserverSnapshotStrategy.java | 5 +++++ 1 file changed, 5 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86cada3b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java ---------------------------------------------------------------------- diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java index ad7e0f3..8d6886e 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java @@ -197,6 +197,11 @@ public class XenserverSnapshotStrategy extends SnapshotStrategyBase { return true; } + if (Snapshot.State.Error.equals(snapshotVO.getState())) { + snapshotDao.remove(snapshotId); + return true; + } + if (snapshotVO.getState() == Snapshot.State.CreatedOnPrimary) { s_logger.debug("delete snapshot on primary storage:"); snapshotVO.setState(Snapshot.State.Destroyed);