use of com.vmware.photon.controller.model.tasks.ProvisionDiskTaskService.ProvisionDiskTaskState in project photon-model by vmware.
the class ProvisionDiskTaskService method doSubStageDiskOperation.
private void doSubStageDiskOperation(ProvisionDiskTaskState updatedState, ProvisionDiskTaskState.SubStage nextStage, DiskInstanceRequest.DiskRequestType diskRequestType) {
Operation.CompletionHandler c = (o, e) -> {
if (e != null) {
failTask(e);
return;
}
DiskInstanceRequest cr = new DiskInstanceRequest();
cr.resourceReference = createInventoryUri(this.getHost(), updatedState.diskLink);
cr.requestType = diskRequestType;
ServiceDocument subTask = o.getBody(ServiceDocument.class);
cr.taskReference = UriUtils.buildUri(this.getHost(), subTask.documentSelfLink);
cr.isMockRequest = updatedState.isMockRequest;
sendHostServiceRequest(cr, updatedState.diskAdapterReference);
};
// after setting boot order and rebooting, we want the sub
// task to patch us, the main task, to the "next" state
createSubTask(c, nextStage, updatedState);
}
use of com.vmware.photon.controller.model.tasks.ProvisionDiskTaskService.ProvisionDiskTaskState in project photon-model by vmware.
the class AzureComputeDiskDay2ServiceTest method kickOffDiskProvisioning.
private void kickOffDiskProvisioning() throws Throwable {
// start provision task to do the actual disk creation
ProvisionDiskTaskState provisionDiskTaskState = new ProvisionDiskTaskState();
provisionDiskTaskState.taskSubStage = ProvisionDiskTaskState.SubStage.CREATING_DISK;
provisionDiskTaskState.diskLink = this.diskState.documentSelfLink;
provisionDiskTaskState.isMockRequest = this.isMock;
provisionDiskTaskState.documentExpirationTimeMicros = Utils.getNowMicrosUtc() + TimeUnit.MINUTES.toMicros(20);
provisionDiskTaskState.tenantLinks = this.endpointState.tenantLinks;
provisionDiskTaskState = TestUtils.doPost(this.host, provisionDiskTaskState, ProvisionDiskTaskState.class, UriUtils.buildUri(this.host, ProvisionDiskTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(ProvisionDiskTaskState.class, provisionDiskTaskState.documentSelfLink);
}
Aggregations