Updated Branches: refs/heads/master 81938c68a -> 358c6e371
CLOUDSTACK-4471. If an instance fails to start then mark the volumes allocated as part of VM creation as removed and set the volume state as destroyed. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/358c6e37 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/358c6e37 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/358c6e37 Branch: refs/heads/master Commit: 358c6e371d1a86cedf38452f4805f521ae0b5458 Parents: 81938c6 Author: Likitha Shetty <[email protected]> Authored: Tue Aug 27 17:29:49 2013 +0530 Committer: Likitha Shetty <[email protected]> Committed: Tue Aug 27 17:31:14 2013 +0530 ---------------------------------------------------------------------- .../engine/orchestration/VolumeOrchestrator.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/358c6e37/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 9a262e7..0e98f48 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -1103,8 +1103,14 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati @Override public void destroyVolume(Volume volume) { try { - volService.destroyVolume(volume.getId()); - } catch (ConcurrentOperationException e) { + // Mark volume as removed if volume has not been created on primary + if (volume.getState() == Volume.State.Allocated) { + _volsDao.remove(volume.getId()); + stateTransitTo(volume, Volume.Event.DestroyRequested); + } else { + volService.destroyVolume(volume.getId()); + } + } catch (Exception e) { s_logger.debug("Failed to destroy volume" + volume.getId(), e); throw new CloudRuntimeException("Failed to destroy volume" + volume.getId(), e); }
