You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/07/23 23:50:48 UTC
git commit: updated refs/heads/master to 5762383
Updated Branches:
refs/heads/master 1898fa504 -> 57623832b
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
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/57623832
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/57623832
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/57623832
Branch: refs/heads/master
Commit: 57623832b00582b0672960d6ab6ce786bf3dd1f3
Parents: 1898fa5
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue Jul 23 14:38:40 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue Jul 23 14:40:59 2013 -0700
----------------------------------------------------------------------
api/src/com/cloud/storage/Volume.java | 3 +++
.../storage/ObjectInDataStoreStateMachine.java | 26 ++++++++++++++------
.../com/cloud/storage/VolumeManagerImpl.java | 10 +++++---
3 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57623832/api/src/com/cloud/storage/Volume.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java
index 342dfd3..9319da9 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);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57623832/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
----------------------------------------------------------------------
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 04522f6..b21616a 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<ObjectInDataStoreStateMachine.State> {
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<ObjectInDataS
}
enum Event {
- CreateRequested, CreateOnlyRequested, DestroyRequested, OperationSuccessed, OperationFailed, CopyingRequested, MigrationRequested, ResizeRequested, ExpungeRequested
-
+ CreateRequested,
+ CreateOnlyRequested,
+ DestroyRequested,
+ OperationSuccessed,
+ OperationFailed,
+ CopyingRequested,
+ MigrationRequested,
+ ResizeRequested,
+ ExpungeRequested
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57623832/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index e8957b4..a77efbd 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -2085,10 +2085,14 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
txn.start();
for (VolumeVO vol : volumesForVm) {
if (vol.getVolumeType().equals(Type.ROOT)) {
- // This check is for VM in Error state (volume is already
- // destroyed)
- if (!vol.getState().equals(Volume.State.Destroy)) {
+ // Destroy volume if not already destroyed
+ boolean volumeAlreadyDestroyed = (vol.getState() == Volume.State.Destroy ||
+ vol.getState() == Volume.State.Expunged ||
+ vol.getState() == Volume.State.Expunging);
+ if (!volumeAlreadyDestroyed) {
volService.destroyVolume(vol.getId());
+ } else {
+ s_logger.debug("Skipping destroy for the volume " + vol + " as its in state " + vol.getState().toString());
}
toBeExpunged.add(vol);
} else {