CLOUDSTACK-7337: Volume state remains in allocated after volume creation 
faliure from snapshot Volume should be marked to Destroy state after creation 
faliure.

Signed-off-by: Koushik Das <kous...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d081786
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d081786
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d081786

Branch: refs/heads/saml2
Commit: 8d0817860faa347eb738c28d30c98f549afb3096
Parents: ab7c1f3
Author: Harikrishna Patnala <harikrishna.patn...@citrix.com>
Authored: Tue Aug 12 16:49:39 2014 +0530
Committer: Koushik Das <kous...@apache.org>
Committed: Wed Aug 20 17:39:53 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d081786/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java 
b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 8d83225..11d1f73 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -659,8 +659,9 @@ public class VolumeApiServiceImpl extends ManagerBase 
implements VolumeApiServic
             return volume;
         } catch (Exception e) {
             created = false;
-            s_logger.debug("Failed to create volume: " + volume.getId(), e);
-            return null;
+            VolumeInfo vol = volFactory.getVolume(cmd.getEntityId());
+            vol.stateTransit(Volume.Event.DestroyRequested);
+            throw new CloudRuntimeException("Failed to create volume: " + 
volume.getId(), e);
         } finally {
             if (!created) {
                 s_logger.trace("Decrementing volume resource count for account 
id=" + volume.getAccountId() + " as volume failed to create on the backend");

Reply via email to