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
This commit is contained in:
Prachi Damle 2014-12-17 11:42:03 -08:00
parent 74720830cd
commit f5d4736c87
3 changed files with 8 additions and 2 deletions

View File

@ -3950,6 +3950,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());

View File

@ -115,8 +115,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));
}
}
}

View File

@ -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;
}