Search in sources :

Example 1 with BulkDeleteParam

use of com.emc.storageos.model.block.BulkDeleteParam in project coprhd-controller by CoprHD.

the class BlockVolumes method deactivate.

/**
 * Begins deactivating multiple block volumes by their IDs.
 * <p>
 * API Call: <tt>POST /block/volumes/deactivate?type={deletionType}</tt>
 *
 * @param ids
 *            The IDs of the block volumes to deactivate.
 * @param deletionType
 *            {@code FULL} or {@code VIPR_ONLY}
 * @return tasks for monitoring the progress of the operations.
 *
 * @see com.emc.storageos.model.block.VolumeDeleteTypeEnum
 */
public Tasks<VolumeRestRep> deactivate(List<URI> ids, VolumeDeleteTypeEnum deletionType) {
    URI uri = client.uriBuilder(baseUrl + "/deactivate").queryParam("type", deletionType).build();
    TaskList tasks = client.postURI(TaskList.class, new BulkDeleteParam(ids), uri);
    return new Tasks<>(client, tasks.getTaskList(), resourceClass);
}
Also used : Tasks(com.emc.vipr.client.Tasks) BulkDeleteParam(com.emc.storageos.model.block.BulkDeleteParam) TaskList(com.emc.storageos.model.TaskList) URI(java.net.URI)

Example 2 with BulkDeleteParam

use of com.emc.storageos.model.block.BulkDeleteParam in project coprhd-controller by CoprHD.

the class BlockService method deleteVolume.

/**
 * Deactivate a volume, will result in permanent deletion of the requested volume(s) from the storage system it was created on and will
 * move the volume to a "marked-for-delete" state after the deletion happens on the array side. The volume will be
 * deleted from the database when all references to this volume of type BlockSnapshot and ExportGroup are deleted.
 *
 * If "?force=true" is added to the path, it will force the delete of internal
 * volumes that have the SUPPORTS_FORCE flag.
 *
 * If "?type=VIPR_ONLY" is added to the path, it will delete volumes only from ViPR data base and leaves the volume on storage array as
 * it is.
 * Possible value for the attribute type : FULL, VIPR_ONLY
 * FULL : Deletes the volumes permanently on array and ViPR data base.
 * VIPR_ONLY : Deletes the volumes only from ViPR data base and leaves the volumes on array as it is.
 *
 * NOTE: This is an asynchronous operation.
 *
 * @prereq Dependent volume resources such as snapshots and export groups must be deleted
 *
 * @param id
 *            the URN of a ViPR volume to delete
 * @param force {@link DefaultValue} false
 * @param type {@link DefaultValue} FULL
 *
 * @brief Delete volume
 * @return Volume information
 *
 * @throws InternalException
 */
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/deactivate")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN, ACL.ALL })
public TaskResourceRep deleteVolume(@PathParam("id") URI id, @DefaultValue("false") @QueryParam("force") boolean force, @DefaultValue("FULL") @QueryParam("type") String type) throws InternalException {
    // Reuse implementation for deleting multiple volumes.
    BulkDeleteParam deleteParam = new BulkDeleteParam();
    deleteParam.setIds(Lists.newArrayList(id));
    TaskList taskList = deleteVolumes(deleteParam, force, type);
    return taskList.getTaskList().get(0);
}
Also used : BulkDeleteParam(com.emc.storageos.model.block.BulkDeleteParam) TaskList(com.emc.storageos.model.TaskList) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with BulkDeleteParam

use of com.emc.storageos.model.block.BulkDeleteParam in project coprhd-controller by CoprHD.

the class BlockConsistencyGroupService method deactivateConsistencyGroupFullCopy.

/**
 * Deactivate the specified consistency group full copy.
 *
 * @prereq none
 *
 * @param cgURI The URI of the consistency group.
 * @param fullCopyURI The URI of the full copy.
 *
 * @brief Deactivate consistency group full copy.
 *
 * @return TaskList
 */
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/protection/full-copies/{fcid}/deactivate")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.ANY })
public TaskList deactivateConsistencyGroupFullCopy(@PathParam("id") URI cgURI, @PathParam("fcid") URI fullCopyURI) {
    // Verify the consistency group in the request and get the
    // volumes in the consistency group.
    List<Volume> cgVolumes = verifyCGForFullCopyRequest(cgURI);
    // block CG operation if any of its volumes is in COPY type VolumeGroup (Application)
    if (isIdEmbeddedInURL(cgURI)) {
        validateVolumeNotPartOfApplication(cgVolumes, FULL_COPY);
    }
    // Verify the full copy.
    verifyFullCopyForCopyRequest(fullCopyURI, cgVolumes);
    // Full copies are volumes, and volumes are deleted by the
    // block service. The block service deactivate method will
    // ensure that full copies in CGs results in all associated
    // being deleted under appropriate conditions.
    BulkDeleteParam param = new BulkDeleteParam();
    param.setIds(Arrays.asList(fullCopyURI));
    return _blockService.deleteVolumes(param, false, VolumeDeleteTypeEnum.FULL.name());
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) BulkDeleteParam(com.emc.storageos.model.block.BulkDeleteParam) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

BulkDeleteParam (com.emc.storageos.model.block.BulkDeleteParam)3 TaskList (com.emc.storageos.model.TaskList)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 POST (javax.ws.rs.POST)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Volume (com.emc.storageos.db.client.model.Volume)1 Tasks (com.emc.vipr.client.Tasks)1 URI (java.net.URI)1