Updated Branches: refs/heads/master-6-17-stable ffb1b02a4 -> 6f86b6b73
CLOUDSTACK-2813 - Some deployment failures do not release the resources. Applying the short term fix of force cleaning up if the answer recieved from startcommand is not valid Signed off by : nitin mehta<[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6f86b6b7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6f86b6b7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6f86b6b7 Branch: refs/heads/master-6-17-stable Commit: 6f86b6b73c8c20ad89847c9584555f6d69c4332e Parents: ffb1b02 Author: Nitin Mehta <[email protected]> Authored: Sun Jun 30 14:51:36 2013 +0530 Committer: Nitin Mehta <[email protected]> Committed: Sun Jun 30 14:51:36 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f86b6b7/server/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 08a7103..de0368a 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -830,6 +830,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id,"memoryOvercommitRatio"); vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue())); vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue())); + StartAnswer startAnswer = null; try { if (!changeState(vm, Event.OperationRetry, destHostId, work, Step.Prepare)) { @@ -874,7 +875,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac _workDao.updateStep(work, Step.Started); - StartAnswer startAnswer = cmds.getAnswer(StartAnswer.class); + startAnswer = cmds.getAnswer(StartAnswer.class); if (startAnswer != null && startAnswer.getResult()) { String host_guid = startAnswer.getHost_guid(); if( host_guid != null ) { @@ -888,6 +889,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (!changeState(vm, Event.OperationSucceeded, destHostId, work, Step.Done)) { throw new ConcurrentOperationException("Unable to transition to a new state."); } + startedVm = vm; if (s_logger.isDebugEnabled()) { s_logger.debug("Start completed for VM " + vm); @@ -943,7 +945,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac if (startedVm == null && canRetry) { Step prevStep = work.getStep(); _workDao.updateStep(work, Step.Release); - if (prevStep == Step.Started || prevStep == Step.Starting) { + // If previous step was started/ing && we got a valid answer + if((prevStep == Step.Started || prevStep == Step.Starting) && (startAnswer != null && startAnswer.getResult())){ //TODO check the response of cleanup and record it in DB for retry cleanup(vmGuru, vmProfile, work, Event.OperationFailed, false, caller, account); } else { //if step is not starting/started, send cleanup command with force=true
