Search in sources :

Example 6 with SnapshotSessionUnlinkTargetParam

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

the class BlockSnapshotSessions method unlinkTarget.

public static void unlinkTarget(String snapshotId, String snapshotSessionId, Boolean deleteOption) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    SnapshotSessionUnlinkTargetsParam unlinkTarget = new SnapshotSessionUnlinkTargetsParam();
    List<SnapshotSessionUnlinkTargetParam> unlinkSessions = Lists.newArrayList();
    SnapshotSessionUnlinkTargetParam unlink = new SnapshotSessionUnlinkTargetParam();
    unlink.setDeleteTarget(deleteOption);
    unlink.setId(uri(snapshotId));
    unlinkSessions.add(unlink);
    unlinkTarget.setLinkedTargets(unlinkSessions);
    client.blockSnapshotSessions().unlinkTargets(uri(snapshotSessionId), unlinkTarget);
    flash.put("info", MessagesUtils.get("resources.snapshot.session.unlink.success", snapshotId));
    snapshotSessionDetails(snapshotSessionId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) SnapshotSessionUnlinkTargetParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam) SnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam)

Example 7 with SnapshotSessionUnlinkTargetParam

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

the class BlockConsistencyGroupService method deactivateAndUnlinkTargetVolumesForSession.

/**
 * This method is called when a linked BlockSnapshot for a BlockSnapshotSession is passed to
 * {@link #deactivateConsistencyGroupSnapshot(URI, URI)} and we must instead unlink&delete it.
 *
 * @param session The BlockSnapshotSession.
 * @param snapshot The BlockSnapshot.
 * @return TaskList wrapping the single TaskResourceRep.
 */
private TaskList deactivateAndUnlinkTargetVolumesForSession(BlockSnapshotSession session, BlockSnapshot snapshot) {
    SnapshotSessionUnlinkTargetParam unlink = new SnapshotSessionUnlinkTargetParam(snapshot.getId(), true);
    SnapshotSessionUnlinkTargetsParam param = new SnapshotSessionUnlinkTargetsParam(newArrayList(unlink));
    TaskResourceRep task = unlinkTargetVolumesFromSnapshotSession(session.getId(), param, OperationTypeEnum.DELETE_CONSISTENCY_GROUP_SNAPSHOT);
    return new TaskList(newArrayList(task));
}
Also used : SnapshotSessionUnlinkTargetParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam) TaskList(com.emc.storageos.model.TaskList) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) SnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam)

Aggregations

SnapshotSessionUnlinkTargetParam (com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam)7 SnapshotSessionUnlinkTargetsParam (com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam)4 TaskList (com.emc.storageos.model.TaskList)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)3 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 NamedURI (com.emc.storageos.db.client.model.NamedURI)2 Operation (com.emc.storageos.db.client.model.Operation)2 NullColumnValueGetter.isNullURI (com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI)2 ServiceCoded (com.emc.storageos.svcs.errorhandling.model.ServiceCoded)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)1 MapBlockSnapshot (com.emc.storageos.api.mapper.functions.MapBlockSnapshot)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1 DataObject (com.emc.storageos.db.client.model.DataObject)1