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 <koushik@apache.org>
This commit is contained in:
Harikrishna Patnala 2014-08-12 16:49:39 +05:30 committed by Koushik Das
parent ab7c1f34d6
commit 8d0817860f

View File

@ -659,8 +659,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
return volume; return volume;
} catch (Exception e) { } catch (Exception e) {
created = false; created = false;
s_logger.debug("Failed to create volume: " + volume.getId(), e); VolumeInfo vol = volFactory.getVolume(cmd.getEntityId());
return null; vol.stateTransit(Volume.Event.DestroyRequested);
throw new CloudRuntimeException("Failed to create volume: " + volume.getId(), e);
} finally { } finally {
if (!created) { if (!created) {
s_logger.trace("Decrementing volume resource count for account id=" + volume.getAccountId() + " as volume failed to create on the backend"); s_logger.trace("Decrementing volume resource count for account id=" + volume.getAccountId() + " as volume failed to create on the backend");