use of com.vmware.photon.controller.model.resources.ComputeService.BootDevice in project photon-model by vmware.
the class ProvisionComputeTaskService method processNextSubStage.
private void processNextSubStage(ProvisionComputeTaskState updatedState) {
ProvisionComputeTaskState.SubStage newStage = updatedState.taskSubStage;
switch(newStage) {
case CREATING_HOST:
ProvisionComputeTaskState.SubStage nextStageOnSuccess = ProvisionComputeTaskState.SubStage.BOOTING_FROM_ANY;
// case.
if (updatedState.bootAdapterReference == null) {
nextStageOnSuccess = ProvisionComputeTaskState.SubStage.VALIDATE_COMPUTE_HOST;
}
// the first reboot needs to be from the network, and the bare metal
// services
// will provide the image reference (retrieved from the computeReference)
doSubStageCreateHost(updatedState, nextStageOnSuccess);
return;
case BOOTING_FROM_NETWORK:
doSubStageBootHost(updatedState, BootDevice.NETWORK, ProvisionComputeTaskState.SubStage.VALIDATE_COMPUTE_HOST);
return;
case BOOTING_FROM_CDROM:
doSubStageBootHost(updatedState, BootDevice.CDROM, ProvisionComputeTaskState.SubStage.VALIDATE_COMPUTE_HOST);
return;
case BOOTING_FROM_ANY:
BootDevice[] bootDevices = new BootDevice[] { BootDevice.DISK, BootDevice.CDROM, BootDevice.NETWORK };
doSubStageBootHost(updatedState, bootDevices, ProvisionComputeTaskState.SubStage.VALIDATE_COMPUTE_HOST);
return;
case VALIDATE_COMPUTE_HOST:
doSubStageValidateComputeHostState(updatedState);
return;
case DONE:
sendSelfPatch(TaskStage.FINISHED, ProvisionComputeTaskState.SubStage.DONE, null);
break;
default:
break;
}
}
use of com.vmware.photon.controller.model.resources.ComputeService.BootDevice in project photon-model by vmware.
the class ProvisionComputeTaskService method doSubStageBootHost.
private void doSubStageBootHost(ProvisionComputeTaskState updatedState, BootDevice[] bootDevices, ProvisionComputeTaskState.SubStage nextStage) {
CompletionHandler c = (o, e) -> {
if (e != null) {
failTask(e);
return;
}
ComputeBootRequest br = new ComputeBootRequest();
br.resourceReference = UriUtils.extendUri(ClusterUtil.getClusterUri(getHost(), ServiceTypeCluster.INVENTORY_SERVICE), updatedState.computeLink);
for (BootDevice bootDevice : bootDevices) {
br.bootDeviceOrder.add(bootDevice);
}
ServiceDocument subTask = o.getBody(ServiceDocument.class);
br.taskReference = UriUtils.buildUri(this.getHost(), subTask.documentSelfLink);
br.isMockRequest = updatedState.isMockRequest;
sendHostServiceRequest(br, updatedState.bootAdapterReference);
};
// After setting boot order and rebooting, we want the sub-task
// to patch the main task to the "next" state.
createSubTask(c, nextStage, updatedState);
}
Aggregations