Search in sources :

Example 26 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method unlinkTargetSnapshot.

public static void unlinkTargetSnapshot(String sessionId, String volumeId, Boolean deleteOption) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    SnapshotSessionUnlinkTargetsParam sessionTargets = new SnapshotSessionUnlinkTargetsParam();
    List<SnapshotSessionUnlinkTargetParam> targetLists = Lists.newArrayList();
    List<RelatedResourceRep> targets = client.blockSnapshotSessions().get(uri(sessionId)).getLinkedTarget();
    List<BlockSnapshotRestRep> snapshots = client.blockSnapshots().getByRefs(targets);
    for (BlockSnapshotRestRep snap : snapshots) {
        SnapshotSessionUnlinkTargetParam targetList = new SnapshotSessionUnlinkTargetParam();
        targetList.setId(snap.getId());
        targetList.setDeleteTarget(deleteOption);
        targetLists.add(targetList);
    }
    if (!targetLists.isEmpty()) {
        sessionTargets.setLinkedTargets(targetLists);
        Task<BlockSnapshotSessionRestRep> tasks = client.blockSnapshotSessions().unlinkTargets(uri(sessionId), sessionTargets);
        flash.put("info", MessagesUtils.get("resources.snapshot.session.unlink.success", sessionId));
    } else {
        flash.error(MessagesUtils.get(NOTARGET, sessionId));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) SnapshotSessionUnlinkTargetParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam) SnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam)

Example 27 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method pauseMigration.

@FlashException(referrer = { "volume" })
public static void pauseMigration(String volumeId, String migrationId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(migrationId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        client.blockMigrations().pause(uri(migrationId));
        flash.put("info", MessagesUtils.get("resources.migrations.pause"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FlashException(controllers.util.FlashException)

Example 28 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method pauseContinuousCopy.

@FlashException(referrer = { "volume" })
public static void pauseContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().pauseContinuousCopies(uri(volumeId), input);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.pause"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Example 29 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method resumeContinuousCopy.

@FlashException(referrer = { "volume" })
public static void resumeContinuousCopy(String volumeId, String continuousCopyId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(continuousCopyId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        CopiesParam input = createCopiesParam(continuousCopyId);
        Tasks<VolumeRestRep> tasks = client.blockVolumes().resumeContinuousCopies(uri(volumeId), input);
        flash.put("info", MessagesUtils.get("resources.continuouscopy.resume"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) CopiesParam(com.emc.storageos.model.block.CopiesParam) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) FlashException(controllers.util.FlashException)

Example 30 with ViPRCoreClient

use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.

the class BlockVolumes method cancelMigration.

@FlashException(referrer = { "volume" })
public static void cancelMigration(String volumeId, String migrationId) {
    if (StringUtils.isNotBlank(volumeId) && StringUtils.isNotBlank(migrationId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        client.blockMigrations().cancel(uri(migrationId));
        flash.put("info", MessagesUtils.get("resources.migrations.cancel"));
    }
    volume(volumeId, null);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FlashException(controllers.util.FlashException)

Aggregations

ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)225 Asset (com.emc.sa.asset.annotation.Asset)72 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)66 URI (java.net.URI)66 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)49 FlashException (controllers.util.FlashException)48 AssetOption (com.emc.vipr.model.catalog.AssetOption)41 ArrayList (java.util.ArrayList)34 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)29 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)27 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)24 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)20 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)15 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)15 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)13 HashSet (java.util.HashSet)13 Task (com.emc.vipr.client.Task)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8