From 8d0817860faa347eb738c28d30c98f549afb3096 Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Tue, 12 Aug 2014 16:49:39 +0530 Subject: [PATCH] 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 --- server/src/com/cloud/storage/VolumeApiServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 8d83225b510..11d1f7314cb 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");