Search in sources :

Example 16 with ProvisionComputeTaskState

use of com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState in project photon-model by vmware.

the class AzurePowerServiceTest method kickOffProvisionTask.

private void kickOffProvisionTask() throws Throwable {
    ProvisionComputeTaskState provisionTask = new ProvisionComputeTaskState();
    provisionTask.computeLink = this.vmState.documentSelfLink;
    provisionTask.isMockRequest = this.isMock;
    provisionTask.taskSubStage = ProvisionComputeTaskState.SubStage.CREATING_HOST;
    provisionTask = TestUtils.doPost(this.host, provisionTask, ProvisionComputeTaskState.class, UriUtils.buildUri(this.host, ProvisionComputeTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(ProvisionComputeTaskState.class, provisionTask.documentSelfLink);
}
Also used : ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState)

Example 17 with ProvisionComputeTaskState

use of com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState in project photon-model by vmware.

the class TestAWSSetupUtils method provisionMachine.

/**
 * Provisions a machine for which the state was created.Expects the peerURI for the location of
 * the service.
 */
public static ComputeState provisionMachine(VerificationHost host, URI peerURI, ComputeState vmState, boolean isMock, List<String> instancesToCleanUp) throws Throwable, InterruptedException, TimeoutException {
    host.log("Provisioning a single virtual machine on AWS.");
    // kick off a provision task to do the actual VM creation
    ProvisionComputeTaskState provisionTask = new ProvisionComputeTaskService.ProvisionComputeTaskState();
    provisionTask.computeLink = vmState.documentSelfLink;
    provisionTask.endpointLink = vmState.endpointLink;
    provisionTask.isMockRequest = isMock;
    provisionTask.taskSubStage = ProvisionComputeTaskState.SubStage.CREATING_HOST;
    ProvisionComputeTaskService.ProvisionComputeTaskState outTask = TestUtils.doPost(host, provisionTask, ProvisionComputeTaskState.class, createServiceURI(host, peerURI, ProvisionComputeTaskService.FACTORY_LINK));
    host.waitForFinishedTask(ProvisionComputeTaskState.class, outTask.documentSelfLink);
    ComputeState provisionCompute = getCompute(host, vmState.documentSelfLink);
    assertNotNull(provisionCompute);
    host.log("Sucessfully provisioned a machine %s ", provisionCompute.id);
    instancesToCleanUp.add(provisionCompute.id);
    return provisionCompute;
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService)

Aggregations

ProvisionComputeTaskState (com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState)17 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)10 ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)7 Test (org.junit.Test)7 EndpointState (com.vmware.photon.controller.model.resources.EndpointService.EndpointState)5 Operation (com.vmware.xenon.common.Operation)5 ProvisionComputeTaskService (com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService)4 PhotonModelServices (com.vmware.photon.controller.model.PhotonModelServices)3 PhotonModelAdaptersRegistryAdapters (com.vmware.photon.controller.model.adapters.registry.PhotonModelAdaptersRegistryAdapters)3 PhotonModelConstants (com.vmware.photon.controller.model.constants.PhotonModelConstants)3 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)3 DiskService (com.vmware.photon.controller.model.resources.DiskService)3 DiskState (com.vmware.photon.controller.model.resources.DiskService.DiskState)3 NetworkInterfaceState (com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState)3 ResourcePoolState (com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)3 TagService (com.vmware.photon.controller.model.resources.TagService)3 TagState (com.vmware.photon.controller.model.resources.TagService.TagState)3 PhotonModelTaskServices (com.vmware.photon.controller.model.tasks.PhotonModelTaskServices)3 ProvisioningUtils (com.vmware.photon.controller.model.tasks.ProvisioningUtils)3 TestUtils (com.vmware.photon.controller.model.tasks.TestUtils)3