CLOUDSTACK-8079: If the cluster capacity threshold is reached, HA-enabled VM is not migrated on another host during HA
Changes: - When there is HA we try to redeploy the affected vm using regular planners and if that fails we retry using the special planner for HA (which skips checking disable threshold) Now because of job framework the InsufficientCapacittyException gets masked and the special planners are not called. Job framework needs to be fixed to rethrow the correct exception. - Also the VM Work Job framework is not setting the DeploymentPlanner to the VmWorkJob. So the HA Planner being passed by HAMgr was not getting used. - Now the job framework sets the planner passed in by any caller of the VM Start operation, to the job Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a7861aa5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a7861aa5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a7861aa5 Branch: refs/heads/master Commit: a7861aa5faabc9ce9422ae2c903471fbf8239abc Parents: 11fa4810 Author: Prachi Damle <prachi.da...@citrix.com> Authored: Wed Dec 17 11:42:03 2014 -0800 Committer: Prachi Damle <prachi.da...@citrix.com> Committed: Wed Dec 17 13:48:24 2014 -0800 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 3 +++ engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java | 4 ++-- server/src/com/cloud/storage/VolumeApiServiceImpl.java | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 8377906..c87b772 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -3949,6 +3949,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER); workInfo.setPlan(planToDeploy); workInfo.setParams(params); + if (planner != null) { + workInfo.setDeploymentPlanner(planner.getName()); + } workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java index f302002..c023511 100644 --- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java +++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java @@ -111,8 +111,8 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch } catch(Throwable e) { s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e); - RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage()); - _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(ex)); + //RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage()); + _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(e)); } } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/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 0914c57..03b64ac 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -925,6 +925,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic if (jobResult instanceof ConcurrentOperationException) { throw (ConcurrentOperationException)jobResult; } + else if (jobResult instanceof ResourceAllocationException) { + throw (ResourceAllocationException)jobResult; + } else if (jobResult instanceof RuntimeException) { throw (RuntimeException)jobResult; }