Search in sources :

Example 1 with PhotonModelUriUtils.createInventoryUri

use of com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri in project photon-model by vmware.

the class VSphereAdapterSnapshotService method handlePatch.

@Override
public void handlePatch(Operation op) {
    if (!op.hasBody()) {
        op.fail(new IllegalArgumentException("body is required"));
        return;
    }
    op.setStatusCode(Operation.STATUS_CODE_CREATED);
    op.complete();
    ResourceOperationRequest request = op.getBody(ResourceOperationRequest.class);
    TaskManager mgr = new TaskManager(this, request.taskReference, request.resourceLink());
    if (request.isMockRequest) {
        mgr.patchTask(TaskStage.FINISHED);
        return;
    }
    if (MapUtils.isEmpty(request.payload)) {
        mgr.patchTaskToFailure(new IllegalArgumentException("Payload is missing for snapshot operation"));
        return;
    }
    SnapshotRequestType requestType = SnapshotRequestType.fromString(request.payload.get(VSphereConstants.VSPHERE_SNAPSHOT_REQUEST_TYPE));
    if (requestType == null) {
        mgr.patchTaskToFailure(new IllegalArgumentException("No Request Type is specified in the payload for snapshot operation"));
        return;
    }
    String computeLink = request.resourceLink();
    String snapshotLink = request.payload.get(VSphereConstants.VSPHERE_SNAPSHOT_DOCUMENT_LINK);
    if ((SnapshotRequestType.DELETE.equals(requestType) || SnapshotRequestType.REVERT.equals(requestType)) && (StringUtils.isBlank(snapshotLink))) {
        mgr.patchTaskToFailure(new IllegalArgumentException("No Snapshot Link is specified in the payload for snapshot operation"));
        return;
    }
    switch(requestType) {
        case CREATE:
            SnapshotContext createSnapshotContext = new SnapshotContext(populateAndGetSnapshotState(request), mgr, requestType, op);
            createSnapshotContext.snapshotMemory = Boolean.valueOf(request.payload.get(VSphereConstants.VSPHERE_SNAPSHOT_MEMORY));
            DeferredResult.completed(createSnapshotContext).thenCompose(this::thenSetComputeDescription).thenCompose(this::thenSetParentComputeDescription).thenCompose(this::querySnapshotStates).thenCompose(this::performSnapshotOperation).whenComplete((context, err) -> {
                if (err != null) {
                    mgr.patchTaskToFailure(err);
                    return;
                }
                mgr.finishTask();
            });
            break;
        case DELETE:
            Operation.createGet(PhotonModelUriUtils.createInventoryUri(this.getHost(), snapshotLink)).setCompletion((o, e) -> {
                if (e != null) {
                    mgr.patchTaskToFailure(e);
                    return;
                }
                SnapshotContext deleteSnapshotContext = new SnapshotContext(o.getBody(SnapshotState.class), mgr, requestType, op);
                if (!computeLink.equals(deleteSnapshotContext.snapshotState.computeLink)) {
                    mgr.patchTaskToFailure(new IllegalArgumentException("Snapshot does not belong to the specified compute."));
                    return;
                }
                DeferredResult.completed(deleteSnapshotContext).thenCompose(this::thenSetComputeDescription).thenCompose(this::thenSetParentComputeDescription).thenCompose(this::performSnapshotOperation).whenComplete((context, err) -> {
                    if (err != null) {
                        mgr.patchTaskToFailure(err);
                        return;
                    }
                    mgr.finishTask();
                });
            }).sendWith(this);
            break;
        case REVERT:
            Operation.createGet(PhotonModelUriUtils.createInventoryUri(this.getHost(), snapshotLink)).setCompletion((o, e) -> {
                if (e != null) {
                    mgr.patchTaskToFailure(e);
                    return;
                }
                SnapshotContext revertSnapshotContext = new SnapshotContext(o.getBody(SnapshotState.class), mgr, requestType, op);
                if (!computeLink.equals(revertSnapshotContext.snapshotState.computeLink)) {
                    mgr.patchTaskToFailure(new IllegalArgumentException("Snapshot does not belong to the specified compute."));
                    return;
                }
                DeferredResult.completed(revertSnapshotContext).thenCompose(this::thenSetComputeDescription).thenCompose(this::thenSetParentComputeDescription).thenCompose(this::querySnapshotStates).thenCompose(this::performSnapshotOperation).whenComplete((context, err) -> {
                    if (err != null) {
                        mgr.patchTaskToFailure(err);
                        return;
                    }
                    mgr.finishTask();
                });
            }).sendWith(this);
            break;
        default:
            mgr.patchTaskToFailure(new IllegalStateException(String.format("Unknown Operation %s for a Snapshot", requestType)));
            break;
    }
}
Also used : Service(com.vmware.xenon.common.Service) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) SessionUtil(com.vmware.photon.controller.model.resources.SessionUtil) ResourceOperationUtils.handleAdapterResourceOperationRegistration(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationUtils.handleAdapterResourceOperationRegistration) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) QueryTask(com.vmware.xenon.services.common.QueryTask) ResourceOperationSpecService(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationSpecService) SnapshotState(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) StringUtils(org.apache.commons.lang3.StringUtils) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) ArrayList(java.util.ArrayList) TargetCriteria(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationUtils.TargetCriteria) Utils(com.vmware.xenon.common.Utils) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) SnapshotRequestType(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotRequestType) BiConsumer(java.util.function.BiConsumer) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) URI(java.net.URI) TaskInfo(com.vmware.vim25.TaskInfo) OperationSequence(com.vmware.xenon.common.OperationSequence) QueryResultsProcessor(com.vmware.xenon.common.QueryResultsProcessor) MapUtils(org.apache.commons.collections.MapUtils) StatelessService(com.vmware.xenon.common.StatelessService) Collection(java.util.Collection) Operation(com.vmware.xenon.common.Operation) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) SnapshotService(com.vmware.photon.controller.model.resources.SnapshotService) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) TaskStage(com.vmware.xenon.common.TaskState.TaskStage) List(java.util.List) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) Optional(java.util.Optional) VSphereConstants(com.vmware.photon.controller.model.adapters.vsphere.constants.VSphereConstants) FactoryService(com.vmware.xenon.common.FactoryService) IAAS_API_ENABLED(com.vmware.photon.controller.model.UriPaths.IAAS_API_ENABLED) TaskInfoState(com.vmware.vim25.TaskInfoState) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) SnapshotRequestType(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotRequestType)

Example 2 with PhotonModelUriUtils.createInventoryUri

use of com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri in project photon-model by vmware.

the class VSphereAdapterSnapshotService method createSnapshot.

private void createSnapshot(Connection connection, SnapshotContext context, DeferredResult<SnapshotContext> deferredResult) {
    ManagedObjectReference vmMoRef = CustomProperties.of(context.computeDescription).getMoRef(CustomProperties.MOREF);
    if (vmMoRef == null) {
        deferredResult.fail(new IllegalStateException("Cannot find VM to snapshot"));
        return;
    }
    ManagedObjectReference task;
    TaskInfo info;
    try {
        logInfo("Creating snapshot for compute resource %s", context.computeDescription.name);
        task = connection.getVimPort().createSnapshotTask(vmMoRef, context.snapshotState.name, context.snapshotState.description, context.snapshotMemory, false);
        info = VimUtils.waitTaskEnd(connection, task);
        if (info.getState() != TaskInfoState.SUCCESS) {
            VimUtils.rethrow(info.getError());
        }
    } catch (Exception e) {
        deferredResult.fail(e);
        return;
    }
    CustomProperties.of(context.snapshotState).put(CustomProperties.MOREF, (ManagedObjectReference) info.getResult());
    // mark this as current snapshot
    context.snapshotState.isCurrent = true;
    // create a new xenon SnapshotState
    logInfo(String.format("Creating a new snapshot state for compute : %s", context.computeDescription.name));
    Operation createSnapshotState = Operation.createPost(PhotonModelUriUtils.createInventoryUri(getHost(), SnapshotService.FACTORY_LINK)).setBody(context.snapshotState);
    if (context.existingSnapshotState != null) {
        // un-mark old snapshot as current snapshot
        context.existingSnapshotState.isCurrent = false;
        Operation patchOldSnapshot = Operation.createPatch(UriUtils.buildUri(getHost(), context.existingSnapshotState.documentSelfLink)).setBody(context.existingSnapshotState);
        OperationSequence.create(createSnapshotState).next(patchOldSnapshot).setCompletion((o, e) -> {
            if (e != null && !e.isEmpty()) {
                deferredResult.fail(e.values().iterator().next());
            }
            deferredResult.complete(context);
        }).sendWith(this);
    } else {
        context.computeDescription.customProperties.put(ComputeProperties.CUSTOM_PROP_COMPUTE_HAS_SNAPSHOTS, "true");
        // patch compute adding the property '_hasSnapshots' with true
        Operation patchCompute = Operation.createPatch(UriUtils.buildUri(getHost(), context.snapshotState.computeLink)).setBody(context.computeDescription);
        OperationSequence.create(createSnapshotState).next(patchCompute).setCompletion((o, e) -> {
            if (e != null && !e.isEmpty()) {
                deferredResult.fail(e.values().iterator().next());
            }
            logInfo(String.format("Created a new snapshot state for compute : %s", context.computeDescription.name));
            deferredResult.complete(context);
        }).sendWith(this);
    }
}
Also used : TaskInfo(com.vmware.vim25.TaskInfo) Service(com.vmware.xenon.common.Service) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) SessionUtil(com.vmware.photon.controller.model.resources.SessionUtil) ResourceOperationUtils.handleAdapterResourceOperationRegistration(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationUtils.handleAdapterResourceOperationRegistration) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) QueryTask(com.vmware.xenon.services.common.QueryTask) ResourceOperationSpecService(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationSpecService) SnapshotState(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) StringUtils(org.apache.commons.lang3.StringUtils) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) ArrayList(java.util.ArrayList) TargetCriteria(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationUtils.TargetCriteria) Utils(com.vmware.xenon.common.Utils) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) SnapshotRequestType(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotRequestType) BiConsumer(java.util.function.BiConsumer) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) URI(java.net.URI) TaskInfo(com.vmware.vim25.TaskInfo) OperationSequence(com.vmware.xenon.common.OperationSequence) QueryResultsProcessor(com.vmware.xenon.common.QueryResultsProcessor) MapUtils(org.apache.commons.collections.MapUtils) StatelessService(com.vmware.xenon.common.StatelessService) Collection(java.util.Collection) Operation(com.vmware.xenon.common.Operation) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) SnapshotService(com.vmware.photon.controller.model.resources.SnapshotService) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) TaskStage(com.vmware.xenon.common.TaskState.TaskStage) List(java.util.List) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) Optional(java.util.Optional) VSphereConstants(com.vmware.photon.controller.model.adapters.vsphere.constants.VSphereConstants) FactoryService(com.vmware.xenon.common.FactoryService) IAAS_API_ENABLED(com.vmware.photon.controller.model.UriPaths.IAAS_API_ENABLED) TaskInfoState(com.vmware.vim25.TaskInfoState) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) Operation(com.vmware.xenon.common.Operation) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 3 with PhotonModelUriUtils.createInventoryUri

use of com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri in project photon-model by vmware.

the class VSphereVMDiskContext method populateVMDiskContextThen.

/**
 * Populates the given initial context and invoke the onSuccess handler when built. At every
 * step, if failure occurs the VSphereVMDiskContext's errorHandler is invoked to cleanup.
 */
protected static void populateVMDiskContextThen(Service service, VSphereVMDiskContext ctx, Consumer<VSphereVMDiskContext> onSuccess) {
    if (ctx.computeDesc == null) {
        URI computeUri = createInventoryUri(service.getHost(), UriUtils.extendUriWithQuery(ctx.request.resourceReference, UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString()));
        AdapterUtils.getServiceState(service, computeUri, op -> {
            ctx.computeDesc = op.getBody(ComputeStateWithDescription.class);
            if (CustomProperties.of(ctx.computeDesc).getString(CustomProperties.MOREF, null) == null) {
                ctx.fail(new IllegalStateException(String.format("VM Moref is not defined in resource %s", ctx.computeDesc.documentSelfLink)));
                return;
            }
            populateVMDiskContextThen(service, ctx, onSuccess);
        }, ctx.errorHandler);
        return;
    }
    if (ctx.diskState == null) {
        URI diskUri = createInventoryUri(service.getHost(), DiskService.DiskStateExpanded.buildUri(UriUtils.buildUri(service.getHost(), ctx.request.payload.get(DISK_LINK))));
        AdapterUtils.getServiceState(service, diskUri, op -> {
            ctx.diskState = op.getBody(DiskService.DiskStateExpanded.class);
            // the VM. So CD_ROM can be in any status.
            if (!ctx.request.isMockRequest) {
                if (ctx.request.operation.equals(ResourceOperation.ATTACH_DISK.operation)) {
                    EnumSet<DiskService.DiskType> notSupportedTypes = EnumSet.of(DiskService.DiskType.SSD, DiskService.DiskType.NETWORK);
                    if (notSupportedTypes.contains(ctx.diskState.type)) {
                        ctx.fail(new IllegalStateException(String.format("Not supported disk type %s.", ctx.diskState.type)));
                        return;
                    }
                    if (ctx.diskState.type == DiskService.DiskType.HDD) {
                        if (ctx.diskState.status != DiskService.DiskStatus.AVAILABLE) {
                            ctx.fail(new IllegalStateException(String.format("Disk %s is not in AVAILABLE status to attach to VM.", ctx.diskState.documentSelfLink)));
                            return;
                        } else if (CustomProperties.of(ctx.diskState).getString(DISK_FULL_PATH, null) == null || CustomProperties.of(ctx.diskState).getString(DISK_DATASTORE_NAME, null) == null) {
                            ctx.fail(new IllegalStateException(String.format("Disk %s is missing path details to attach to VM.", ctx.diskState.documentSelfLink)));
                            return;
                        }
                    }
                } else {
                    // Allowing only HDD based disk to be detached
                    if (ctx.diskState.type != DiskService.DiskType.HDD) {
                        ctx.fail(new IllegalStateException(String.format("Not supported disk type %s for detach.", ctx.diskState.type)));
                        return;
                    }
                    if (ctx.diskState.status != DiskService.DiskStatus.ATTACHED) {
                        ctx.fail(new IllegalStateException(String.format("Disk %s is not in ATTACHED status to detach from VM.", ctx.diskState.documentSelfLink)));
                        return;
                    }
                }
            }
            // fetch the content from the content service
            if (ctx.diskState.type == DiskService.DiskType.CDROM) {
                String contentUriStr = CustomProperties.of(ctx.diskState).getString(DISK_CONTENT_LINK, null);
                if (contentUriStr != null) {
                    ctx.contentLink = contentUriStr;
                    URI contentUri = PhotonModelUriUtils.createInventoryUri(service.getHost(), UriUtils.buildUri(service.getHost(), contentUriStr));
                    AdapterUtils.getServiceState(service, contentUri, MEDIA_TYPE_APPLICATION_OCTET_STREAM, op2 -> {
                        ctx.contentToUpload = op2.getBody(byte[].class);
                        populateVMDiskContextThen(service, ctx, onSuccess);
                    }, ctx.errorHandler);
                } else {
                    populateVMDiskContextThen(service, ctx, onSuccess);
                }
            } else {
                populateVMDiskContextThen(service, ctx, onSuccess);
            }
        }, ctx.errorHandler);
        return;
    }
    // If it is CD-ROM attach then collect all the disk links objects if insertCDRom is true
    if (ctx.computeDiskStates == null) {
        Boolean insertCdRom = CustomProperties.of(ctx.diskState).getBoolean(INSERT_CDROM, false);
        if (ctx.diskState.type == DiskService.DiskType.CDROM && insertCdRom && ctx.computeDesc.diskLinks != null && !ctx.computeDesc.diskLinks.isEmpty()) {
            ctx.computeDiskStates = new ArrayList<>(ctx.computeDesc.diskLinks.size());
            // collect disks in parallel
            Stream<Operation> opsGetDisk = ctx.computeDesc.diskLinks.stream().map(link -> {
                URI diskStateUri = createInventoryUri(service.getHost(), link);
                return Operation.createGet(createInventoryUri(service.getHost(), DiskService.DiskStateExpanded.buildUri(diskStateUri)));
            });
            OperationJoin join = OperationJoin.create(opsGetDisk).setCompletion((os, errors) -> {
                if (errors != null && !errors.isEmpty()) {
                    // fail on first error
                    ctx.errorHandler.accept(new IllegalStateException("Cannot get disk state", errors.values().iterator().next()));
                    return;
                }
                os.values().forEach(op -> ctx.computeDiskStates.add(op.getBody(DiskService.DiskStateExpanded.class)));
                populateVMDiskContextThen(service, ctx, onSuccess);
            });
            join.sendWith(service);
        } else {
            ctx.computeDiskStates = Collections.emptyList();
            populateVMDiskContextThen(service, ctx, onSuccess);
        }
        return;
    }
    if (ctx.parentComputeDesc == null && ctx.computeDesc.parentLink != null) {
        URI computeUri = createInventoryUri(service.getHost(), UriUtils.extendUriWithQuery(UriUtils.buildUri(service.getHost(), ctx.computeDesc.parentLink), UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString()));
        AdapterUtils.getServiceState(service, computeUri, op -> {
            ctx.parentComputeDesc = op.getBody(ComputeStateWithDescription.class);
            populateVMDiskContextThen(service, ctx, onSuccess);
        }, ctx.errorHandler);
        return;
    }
    if (ctx.vSphereCredentials == null) {
        if (IAAS_API_ENABLED) {
            if (ctx.operation == null) {
                ctx.fail(new IllegalArgumentException("Caller operation cannot be empty"));
                return;
            }
            SessionUtil.retrieveExternalToken(service, ctx.operation.getAuthorizationContext()).whenComplete((authCredentialsServiceState, throwable) -> {
                if (throwable != null) {
                    ctx.errorHandler.accept(throwable);
                    return;
                }
                ctx.vSphereCredentials = authCredentialsServiceState;
                populateVMDiskContextThen(service, ctx, onSuccess);
            });
        } else {
            if (ctx.parentComputeDesc.description.authCredentialsLink == null) {
                ctx.fail(new IllegalStateException(String.format("authCredentialsLink is not defined in resource %s", ctx.parentComputeDesc.description.documentSelfLink)));
                return;
            }
            URI credUri = createInventoryUri(service.getHost(), ctx.parentComputeDesc.description.authCredentialsLink);
            AdapterUtils.getServiceState(service, credUri, op -> {
                ctx.vSphereCredentials = op.getBody(AuthCredentialsServiceState.class);
                populateVMDiskContextThen(service, ctx, onSuccess);
            }, ctx.errorHandler);
        }
        return;
    }
    if (ctx.datacenterMoRef == null) {
        try {
            String regionId = ctx.diskState.regionId;
            if (regionId == null || regionId.isEmpty()) {
                if (ctx.computeDesc.regionId != null) {
                    regionId = ctx.computeDesc.regionId;
                } else if (ctx.parentComputeDesc.regionId != null) {
                    regionId = ctx.parentComputeDesc.regionId;
                }
            }
            ctx.datacenterMoRef = VimUtils.convertStringToMoRef(regionId);
        } catch (IllegalArgumentException ex) {
            ctx.fail(ex);
            return;
        }
        populateVMDiskContextThen(service, ctx, onSuccess);
        return;
    }
    if (ctx.computePlacementHost == null) {
        String placementLink = CustomProperties.of(ctx.computeDesc).getString(ComputeProperties.COMPUTE_HOST_LINK_PROP_NAME);
        // compute host link will be not null here.
        URI expandedPlacementUri = UriUtils.extendUriWithQuery(PhotonModelUriUtils.createInventoryUri(service.getHost(), placementLink), UriUtils.URI_PARAM_ODATA_EXPAND, Boolean.TRUE.toString());
        expandedPlacementUri = PhotonModelUriUtils.createInventoryUri(service.getHost(), expandedPlacementUri);
        AdapterUtils.getServiceState(service, expandedPlacementUri, op -> {
            ctx.computePlacementHost = op.getBody(ComputeStateWithDescription.class);
            if (ctx.computePlacementHost.groupLinks != null) {
                ctx.computeGroupLinks = ctx.computePlacementHost.groupLinks.stream().filter(link -> link.contains(PREFIX_DATASTORE)).collect(Collectors.toSet());
            }
            populateVMDiskContextThen(service, ctx, onSuccess);
        }, ctx.errorHandler);
        return;
    }
    // populate datastore name
    if (ctx.datastoreName == null) {
        if (ctx.diskState.customProperties != null && ctx.diskState.customProperties.get(DISK_DATASTORE_NAME) != null) {
            ctx.datastoreName = ctx.diskState.customProperties.get(DISK_DATASTORE_NAME);
            populateVMDiskContextThen(service, ctx, onSuccess);
        } else if (ctx.diskState.storageDescription != null) {
            ctx.datastoreName = ctx.diskState.storageDescription.id;
            populateVMDiskContextThen(service, ctx, onSuccess);
        } else if (ctx.diskState.resourceGroupStates != null && !ctx.diskState.resourceGroupStates.isEmpty()) {
            // There will always be only one resource group state existing for a disk
            ResourceGroupService.ResourceGroupState resource = ctx.diskState.resourceGroupStates.iterator().next();
            ClientUtils.getDatastoresForProfile(service, resource.documentSelfLink, ctx.diskState.endpointLink, ctx.diskState.tenantLinks, ctx.errorHandler, (result) -> {
                if (result.documents != null && result.documents.size() > 0) {
                    // pick the first datastore and proceed.
                    ctx.datastoreName = Utils.fromJson(result.documents.values().iterator().next(), StorageDescriptionService.StorageDescription.class).id;
                } else {
                    // Since no result found default to the available datastore.
                    ctx.datastoreName = "";
                }
                populateVMDiskContextThen(service, ctx, onSuccess);
            });
        } else if (ctx.computeGroupLinks != null) {
            // try to get the datastore form the placement link of compute
            String datastoreLink = ctx.computeGroupLinks.iterator().next();
            URI dsUri = PhotonModelUriUtils.createInventoryUri(service.getHost(), UriUtils.buildUri(service.getHost(), datastoreLink));
            AdapterUtils.getServiceState(service, dsUri, op -> {
                ResourceGroupService.ResourceGroupState rgState = op.getBody(ResourceGroupService.ResourceGroupState.class);
                ctx.datastoreName = rgState.id;
                populateVMDiskContextThen(service, ctx, onSuccess);
            }, ctx.errorHandler);
        } else {
            ctx.datastoreName = "";
            populateVMDiskContextThen(service, ctx, onSuccess);
        }
        return;
    }
    // context populated, invoke handler
    onSuccess.accept(ctx);
}
Also used : Service(com.vmware.xenon.common.Service) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) SessionUtil(com.vmware.photon.controller.model.resources.SessionUtil) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) INSERT_CDROM(com.vmware.photon.controller.model.constants.PhotonModelConstants.INSERT_CDROM) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) ArrayList(java.util.ArrayList) DISK_FULL_PATH(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_FULL_PATH) Utils(com.vmware.xenon.common.Utils) DISK_DATASTORE_NAME(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_DATASTORE_NAME) URI(java.net.URI) EnumSet(java.util.EnumSet) AdapterUtils(com.vmware.photon.controller.model.adapters.util.AdapterUtils) Operation(com.vmware.xenon.common.Operation) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) DISK_LINK(com.vmware.photon.controller.model.constants.PhotonModelConstants.DISK_LINK) MEDIA_TYPE_APPLICATION_OCTET_STREAM(com.vmware.xenon.common.Operation.MEDIA_TYPE_APPLICATION_OCTET_STREAM) Set(java.util.Set) Collectors(java.util.stream.Collectors) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) Consumer(java.util.function.Consumer) ResourceGroupService(com.vmware.photon.controller.model.resources.ResourceGroupService) List(java.util.List) Stream(java.util.stream.Stream) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) DISK_CONTENT_LINK(com.vmware.photon.controller.model.constants.PhotonModelConstants.DISK_CONTENT_LINK) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService) UriUtils(com.vmware.xenon.common.UriUtils) IAAS_API_ENABLED(com.vmware.photon.controller.model.UriPaths.IAAS_API_ENABLED) DiskService(com.vmware.photon.controller.model.resources.DiskService) PREFIX_DATASTORE(com.vmware.photon.controller.model.adapters.vsphere.VSphereIncrementalEnumerationService.PREFIX_DATASTORE) Collections(java.util.Collections) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) ComputeStateWithDescription(com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription) OperationJoin(com.vmware.xenon.common.OperationJoin) Operation(com.vmware.xenon.common.Operation) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) URI(java.net.URI) DiskService(com.vmware.photon.controller.model.resources.DiskService) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) ResourceGroupService(com.vmware.photon.controller.model.resources.ResourceGroupService) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService)

Example 4 with PhotonModelUriUtils.createInventoryUri

use of com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri in project photon-model by vmware.

the class VSphereVirtualMachineEnumerationHelper method createNewVm.

static void createNewVm(VSphereIncrementalEnumerationService service, EnumerationProgress enumerationProgress, VmOverlay vm) {
    ComputeDescription desc = makeDescriptionForVm(service, enumerationProgress, vm);
    desc.tenantLinks = enumerationProgress.getTenantLinks();
    Operation.createPost(PhotonModelUriUtils.createInventoryUri(service.getHost(), ComputeDescriptionService.FACTORY_LINK)).setBody(desc).sendWith(service);
    ComputeState state = makeVmFromResults(enumerationProgress, vm);
    state.descriptionLink = desc.documentSelfLink;
    state.tenantLinks = enumerationProgress.getTenantLinks();
    List<Operation> operations = new ArrayList<>();
    VsphereEnumerationHelper.submitWorkToVSpherePool(service, () -> {
        VsphereEnumerationHelper.populateTags(service, enumerationProgress, vm, state);
        state.networkInterfaceLinks = new ArrayList<>();
        Map<String, List<String>> nicToIPv4Addresses = vm.getMapNic2IpV4Addresses();
        for (VirtualEthernetCard nic : vm.getNics()) {
            VirtualDeviceBackingInfo backing = nic.getBacking();
            if (backing instanceof VirtualEthernetCardNetworkBackingInfo) {
                VirtualEthernetCardNetworkBackingInfo veth = (VirtualEthernetCardNetworkBackingInfo) backing;
                NetworkInterfaceState iface = new NetworkInterfaceState();
                iface.networkLink = enumerationProgress.getNetworkTracker().getSelfLink(veth.getNetwork());
                iface.name = nic.getDeviceInfo().getLabel();
                iface.documentSelfLink = buildUriPath(NetworkInterfaceService.FACTORY_LINK, service.getHost().nextUUID());
                iface.address = getPrimaryIPv4Address(nic, nicToIPv4Addresses);
                CustomProperties.of(iface).put(CustomProperties.DATACENTER_SELF_LINK, enumerationProgress.getDcLink());
                Operation.createPost(PhotonModelUriUtils.createInventoryUri(service.getHost(), NetworkInterfaceService.FACTORY_LINK)).setBody(iface).sendWith(service);
                state.networkInterfaceLinks.add(iface.documentSelfLink);
            } else if (backing instanceof VirtualEthernetCardDistributedVirtualPortBackingInfo) {
                VirtualEthernetCardDistributedVirtualPortBackingInfo veth = (VirtualEthernetCardDistributedVirtualPortBackingInfo) backing;
                String portgroupKey = veth.getPort().getPortgroupKey();
                Operation op = addNewInterfaceState(service, enumerationProgress, state, portgroupKey, InterfaceStateMode.INTERFACE_STATE_WITH_DISTRIBUTED_VIRTUAL_PORT, SubnetState.class, SubnetState.class, getPrimaryIPv4Address(nic, nicToIPv4Addresses));
                if (op != null) {
                    operations.add(op);
                }
            } else if (backing instanceof VirtualEthernetCardOpaqueNetworkBackingInfo) {
                VirtualEthernetCardOpaqueNetworkBackingInfo veth = (VirtualEthernetCardOpaqueNetworkBackingInfo) backing;
                String opaqueNetworkId = veth.getOpaqueNetworkId();
                Operation op = addNewInterfaceState(service, enumerationProgress, state, opaqueNetworkId, InterfaceStateMode.INTERFACE_STATE_WITH_OPAQUE_NETWORK, NetworkState.class, NetworkState.class, getPrimaryIPv4Address(nic, nicToIPv4Addresses));
                if (op != null) {
                    operations.add(op);
                }
            } else {
                // TODO add support for DVS
                service.logFine(() -> String.format("Will not add nic of type %s", backing.getClass().getName()));
            }
        }
        // Process all the disks attached to the VM
        List<VirtualDevice> disks = vm.getDisks();
        if (CollectionUtils.isNotEmpty(disks)) {
            state.diskLinks = new ArrayList<>(disks.size());
            for (VirtualDevice device : disks) {
                Operation vdOp = processVirtualDevice(service, null, device, enumerationProgress, state.diskLinks, VimUtils.convertMoRefToString(vm.getId()), null);
                if (vdOp != null) {
                    operations.add(vdOp);
                }
            }
        }
        service.logFine(() -> String.format("Found new VM %s", vm.getInstanceUuid()));
        if (operations.isEmpty()) {
            Operation.createPost(PhotonModelUriUtils.createInventoryUri(service.getHost(), ComputeService.FACTORY_LINK)).setBody(state).setCompletion(trackVm(enumerationProgress)).sendWith(service);
        } else {
            OperationJoin.create(operations).setCompletion((operationMap, exception) -> {
                Operation.createPost(PhotonModelUriUtils.createInventoryUri(service.getHost(), ComputeService.FACTORY_LINK)).setBody(state).setCompletion(updateVirtualDisksAndTrackVm(service, enumerationProgress, operationMap)).sendWith(service);
            }).sendWith(service);
        }
    });
}
Also used : ComputeEnumerateResourceRequest(com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest) VirtualEthernetCardOpaqueNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardOpaqueNetworkBackingInfo) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) QueryTask(com.vmware.xenon.services.common.QueryTask) LifecycleState(com.vmware.photon.controller.model.resources.ComputeService.LifecycleState) SnapshotState(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) Map(java.util.Map) URI(java.net.URI) VirtualDevice(com.vmware.vim25.VirtualDevice) NsxProperties(com.vmware.photon.controller.model.adapters.vsphere.network.NsxProperties) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) Collectors(java.util.stream.Collectors) SnapshotService(com.vmware.photon.controller.model.resources.SnapshotService) ClientUtils.handleVirtualDiskUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDiskUpdate) List(java.util.List) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) CompletionHandler(com.vmware.xenon.common.Operation.CompletionHandler) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) ClientUtils.handleVirtualDeviceUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDeviceUpdate) Builder(com.vmware.xenon.services.common.QueryTask.Query.Builder) DiskService(com.vmware.photon.controller.model.resources.DiskService) VirtualFloppy(com.vmware.vim25.VirtualFloppy) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceCleanRequest(com.vmware.photon.controller.model.adapters.vsphere.VsphereResourceCleanerService.ResourceCleanRequest) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) ObjectUpdateKind(com.vmware.vim25.ObjectUpdateKind) VirtualEthernetCardDistributedVirtualPortBackingInfo(com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo) ComputeDescriptionService(com.vmware.photon.controller.model.resources.ComputeDescriptionService) VirtualEthernetCardNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo) ArrayList(java.util.ArrayList) VirtualCdrom(com.vmware.vim25.VirtualCdrom) ClientUtils.findMatchingDiskState(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingDiskState) CollectionUtils(org.apache.commons.collections.CollectionUtils) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) AdapterUtils(com.vmware.photon.controller.model.adapters.util.AdapterUtils) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) Operation(com.vmware.xenon.common.Operation) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) VimNames(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) TYPE_PORTGROUP(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames.TYPE_PORTGROUP) VirtualDisk(com.vmware.vim25.VirtualDisk) UriUtils.buildUriPath(com.vmware.xenon.common.UriUtils.buildUriPath) InterfaceStateMode(com.vmware.photon.controller.model.adapters.vsphere.VSphereIncrementalEnumerationService.InterfaceStateMode) ObjectUpdate(com.vmware.vim25.ObjectUpdate) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) VirtualEthernetCardDistributedVirtualPortBackingInfo(com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo) VirtualEthernetCardNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo) VirtualEthernetCardOpaqueNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardOpaqueNetworkBackingInfo) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) ArrayList(java.util.ArrayList) VirtualDevice(com.vmware.vim25.VirtualDevice) Operation(com.vmware.xenon.common.Operation) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) List(java.util.List) ArrayList(java.util.ArrayList) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard)

Example 5 with PhotonModelUriUtils.createInventoryUri

use of com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri in project photon-model by vmware.

the class VSphereVirtualMachineEnumerationHelper method deleteVM.

private static void deleteVM(EnumerationProgress enumerationProgress, VmOverlay vmOverlay, VSphereIncrementalEnumerationService service, ServiceDocument oldDocument) {
    if (!enumerationProgress.getRequest().preserveMissing) {
        Operation.createDelete(PhotonModelUriUtils.createInventoryUri(service.getHost(), oldDocument.documentSelfLink)).setCompletion((o, e) -> {
            trackVm(enumerationProgress).handle(o, e);
        }).sendWith(service);
    } else {
        ResourceCleanRequest patch = new ResourceCleanRequest();
        patch.resourceLink = oldDocument.documentSelfLink;
        Operation.createPatch(service, VSphereUriPaths.RESOURCE_CLEANER).setBody(patch).setCompletion((o, e) -> {
            trackVm(enumerationProgress).handle(o, e);
        }).sendWith(service);
    }
}
Also used : ComputeEnumerateResourceRequest(com.vmware.photon.controller.model.adapterapi.ComputeEnumerateResourceRequest) VirtualEthernetCardOpaqueNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardOpaqueNetworkBackingInfo) ServiceTypeCluster(com.vmware.photon.controller.model.util.ClusterUtil.ServiceTypeCluster) QueryTask(com.vmware.xenon.services.common.QueryTask) LifecycleState(com.vmware.photon.controller.model.resources.ComputeService.LifecycleState) SnapshotState(com.vmware.photon.controller.model.resources.SnapshotService.SnapshotState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) Map(java.util.Map) URI(java.net.URI) VirtualDevice(com.vmware.vim25.VirtualDevice) NsxProperties(com.vmware.photon.controller.model.adapters.vsphere.network.NsxProperties) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) Collectors(java.util.stream.Collectors) SnapshotService(com.vmware.photon.controller.model.resources.SnapshotService) ClientUtils.handleVirtualDiskUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDiskUpdate) List(java.util.List) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) CompletionHandler(com.vmware.xenon.common.Operation.CompletionHandler) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) ClientUtils.handleVirtualDeviceUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDeviceUpdate) Builder(com.vmware.xenon.services.common.QueryTask.Query.Builder) DiskService(com.vmware.photon.controller.model.resources.DiskService) VirtualFloppy(com.vmware.vim25.VirtualFloppy) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceCleanRequest(com.vmware.photon.controller.model.adapters.vsphere.VsphereResourceCleanerService.ResourceCleanRequest) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) ObjectUpdateKind(com.vmware.vim25.ObjectUpdateKind) VirtualEthernetCardDistributedVirtualPortBackingInfo(com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo) ComputeDescriptionService(com.vmware.photon.controller.model.resources.ComputeDescriptionService) VirtualEthernetCardNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo) ArrayList(java.util.ArrayList) VirtualCdrom(com.vmware.vim25.VirtualCdrom) ClientUtils.findMatchingDiskState(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingDiskState) CollectionUtils(org.apache.commons.collections.CollectionUtils) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) AdapterUtils(com.vmware.photon.controller.model.adapters.util.AdapterUtils) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) Operation(com.vmware.xenon.common.Operation) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) VimNames(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) TYPE_PORTGROUP(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames.TYPE_PORTGROUP) VirtualDisk(com.vmware.vim25.VirtualDisk) UriUtils.buildUriPath(com.vmware.xenon.common.UriUtils.buildUriPath) InterfaceStateMode(com.vmware.photon.controller.model.adapters.vsphere.VSphereIncrementalEnumerationService.InterfaceStateMode) ObjectUpdate(com.vmware.vim25.ObjectUpdate) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) OperationJoin(com.vmware.xenon.common.OperationJoin) PhotonModelUriUtils.createInventoryUri(com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri) ResourceCleanRequest(com.vmware.photon.controller.model.adapters.vsphere.VsphereResourceCleanerService.ResourceCleanRequest)

Aggregations

PhotonModelUriUtils (com.vmware.photon.controller.model.util.PhotonModelUriUtils)8 PhotonModelUriUtils.createInventoryUri (com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri)8 Operation (com.vmware.xenon.common.Operation)8 OperationJoin (com.vmware.xenon.common.OperationJoin)8 UriUtils (com.vmware.xenon.common.UriUtils)8 URI (java.net.URI)8 ArrayList (java.util.ArrayList)8 List (java.util.List)8 ComputeProperties (com.vmware.photon.controller.model.ComputeProperties)7 QueryUtils (com.vmware.photon.controller.model.query.QueryUtils)7 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)7 QueryTask (com.vmware.xenon.services.common.QueryTask)7 Collectors (java.util.stream.Collectors)7 SnapshotService (com.vmware.photon.controller.model.resources.SnapshotService)6 SnapshotState (com.vmware.photon.controller.model.resources.SnapshotService.SnapshotState)6 DeferredResult (com.vmware.xenon.common.DeferredResult)6 ServiceDocument (com.vmware.xenon.common.ServiceDocument)6 AdapterUtils (com.vmware.photon.controller.model.adapters.util.AdapterUtils)5 TaskManager (com.vmware.photon.controller.model.adapters.util.TaskManager)5 ComputeStateWithDescription (com.vmware.photon.controller.model.resources.ComputeService.ComputeStateWithDescription)5