Search in sources :

Example 1 with ComputeBootRequest

use of com.vmware.photon.controller.model.adapterapi.ComputeBootRequest 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);
}
Also used : ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) ComputeBootRequest(com.vmware.photon.controller.model.adapterapi.ComputeBootRequest) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) Operation(com.vmware.xenon.common.Operation) ServiceDocument(com.vmware.xenon.common.ServiceDocument) InstanceRequestType(com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest.InstanceRequestType) BootDevice(com.vmware.photon.controller.model.resources.ComputeService.BootDevice) TaskStage(com.vmware.xenon.common.TaskState.TaskStage) ComputeInstanceRequest(com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Utils(com.vmware.xenon.common.Utils) UriPaths(com.vmware.photon.controller.model.UriPaths) ClusterUtil(com.vmware.photon.controller.model.util.ClusterUtil) CompletionHandler(com.vmware.xenon.common.Operation.CompletionHandler) InetAddressValidator(org.apache.commons.validator.routines.InetAddressValidator) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) TaskState(com.vmware.xenon.common.TaskState) URI(java.net.URI) TaskService(com.vmware.xenon.services.common.TaskService) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) SubStage(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState.SubStage) BootDevice(com.vmware.photon.controller.model.resources.ComputeService.BootDevice) CompletionHandler(com.vmware.xenon.common.Operation.CompletionHandler) ServiceDocument(com.vmware.xenon.common.ServiceDocument) ComputeBootRequest(com.vmware.photon.controller.model.adapterapi.ComputeBootRequest)

Aggregations

UriPaths (com.vmware.photon.controller.model.UriPaths)1 ComputeBootRequest (com.vmware.photon.controller.model.adapterapi.ComputeBootRequest)1 ComputeInstanceRequest (com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest)1 InstanceRequestType (com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest.InstanceRequestType)1 ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)1 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)1 BootDevice (com.vmware.photon.controller.model.resources.ComputeService.BootDevice)1 SubStage (com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState.SubStage)1 ClusterUtil (com.vmware.photon.controller.model.util.ClusterUtil)1 ServiceTypeCluster (com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster)1 PhotonModelUriUtils.createInventoryUri (com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri)1 Operation (com.vmware.xenon.common.Operation)1 CompletionHandler (com.vmware.xenon.common.Operation.CompletionHandler)1 ServiceDocument (com.vmware.xenon.common.ServiceDocument)1 TaskState (com.vmware.xenon.common.TaskState)1 TaskStage (com.vmware.xenon.common.TaskState.TaskStage)1 UriUtils (com.vmware.xenon.common.UriUtils)1 Utils (com.vmware.xenon.common.Utils)1 TaskService (com.vmware.xenon.services.common.TaskService)1 URI (java.net.URI)1