From 8d1a670026ac052cb4121a69e17ca907909c26f7 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 23 Jul 2013 14:38:40 -0700 Subject: [PATCH] CLOUDSTACK-3478: fixed volume destroy. #1 - don't call destroy() when the volume is in Expunged/Expunging/Destroy state. #2 - added state transition for Expunged state --- api/src/com/cloud/storage/Volume.java | 3 +++ .../ObjectInDataStoreStateMachine.java | 26 ++++++++++++++----- .../com/cloud/storage/VolumeManagerImpl.java | 10 ++++--- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java index 342dfd3ab2e..9319da9d29b 100755 --- a/api/src/com/cloud/storage/Volume.java +++ b/api/src/com/cloud/storage/Volume.java @@ -93,6 +93,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba s_fsm.addTransition(UploadOp, Event.OperationSucceeded, Uploaded); s_fsm.addTransition(UploadOp, Event.OperationFailed, Allocated); s_fsm.addTransition(Uploaded, Event.DestroyRequested, Destroy); + s_fsm.addTransition(Expunged, Event.ExpungingRequested, Expunged); + s_fsm.addTransition(Expunged, Event.OperationSucceeded, Expunged); + s_fsm.addTransition(Expunged, Event.OperationFailed, Expunged); } } diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java index 04522f628d5..b21616a5094 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java @@ -22,11 +22,16 @@ import com.cloud.utils.fsm.StateObject; public interface ObjectInDataStoreStateMachine extends StateObject { enum State { - Allocated("The initial state"), Creating2("This is only used with createOnlyRequested event"), Creating( - "The object is being creating on data store"), Created("The object is created"), Ready( - "Template downloading is accomplished"), Copying("The object is being coping"), Migrating( - "The object is being migrated"), Destroying("Template is destroying"), Destroyed( - "Template is destroyed"), Failed("Failed to download template"); + Allocated("The initial state"), + Creating2("This is only used with createOnlyRequested event"), + Creating("The object is being creating on data store"), + Created("The object is created"), + Ready("Template downloading is accomplished"), + Copying("The object is being coping"), + Migrating("The object is being migrated"), + Destroying("Template is destroying"), + Destroyed("Template is destroyed"), + Failed("Failed to download template"); String _description; private State(String description) { @@ -39,7 +44,14 @@ public interface ObjectInDataStoreStateMachine extends StateObject