Skip to content

Commit a7861aa

Browse files
author
Prachi Damle
committed
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
1 parent 11fa481 commit a7861aa

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3949,6 +3949,9 @@ public Outcome<VirtualMachine> startVmThroughJobQueue(final String vmUuid,
39493949
VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER);
39503950
workInfo.setPlan(planToDeploy);
39513951
workInfo.setParams(params);
3952+
if (planner != null) {
3953+
workInfo.setDeploymentPlanner(planner.getName());
3954+
}
39523955
workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));
39533956

39543957
_jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());

engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ public void runJob(AsyncJob job) {
111111
} catch(Throwable e) {
112112
s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e);
113113

114-
RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage());
115-
_asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(ex));
114+
//RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage());
115+
_asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(e));
116116
}
117117
}
118118
}

server/src/com/cloud/storage/VolumeApiServiceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ public VolumeVO resizeVolume(ResizeVolumeCmd cmd) throws ResourceAllocationExcep
925925
if (jobResult instanceof ConcurrentOperationException) {
926926
throw (ConcurrentOperationException)jobResult;
927927
}
928+
else if (jobResult instanceof ResourceAllocationException) {
929+
throw (ResourceAllocationException)jobResult;
930+
}
928931
else if (jobResult instanceof RuntimeException) {
929932
throw (RuntimeException)jobResult;
930933
}

0 commit comments

Comments
 (0)