Search in sources :

Example 21 with VolumeRestRep

use of com.emc.storageos.model.block.VolumeRestRep 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 22 with VolumeRestRep

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

the class BlockVolumes method volumeSnapshotSessions.

public static void volumeSnapshotSessions(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
    List<BlockSnapshotSessionRestRep> snapshotSessions = Lists.newArrayList();
    if (volume.getConsistencyGroup() != null) {
        URI consistencygroup = volume.getConsistencyGroup().getId();
        List<NamedRelatedResourceRep> cgSessions = client.blockConsistencyGroups().getSnapshotSessions(consistencygroup);
        snapshotSessions = client.blockSnapshotSessions().getByRefs(cgSessions);
    } else {
        List<NamedRelatedResourceRep> refs = client.blockSnapshotSessions().listByVolume(uri(volumeId));
        snapshotSessions = client.blockSnapshotSessions().getByRefs(refs);
    }
    render(snapshotSessions, volumeId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 23 with VolumeRestRep

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

the class BlockVolumes method volumeDetails.

public static void volumeDetails(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    String consistencygroup = "";
    VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
    if (volume == null) {
        error(MessagesUtils.get(UNKNOWN, volumeId));
    }
    if (volume.getConsistencyGroup() != null) {
        consistencygroup = client.blockConsistencyGroups().get(volume.getConsistencyGroup().getId()).getName();
    }
    render(consistencygroup);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 24 with VolumeRestRep

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

the class TestBlockProviderFilter method filter.

static void filter(ViPRCoreClient client, URI project) {
    List<VolumeRestRep> volumes = listVolumes(client, project);
    List<VolumeDetail> volumeDetails = getVolumeDetails(client, volumes);
    Map<URI, VolumeRestRep> volumeNames = ResourceUtils.mapById(volumes);
    List<AssetOption> options = Lists.newArrayList();
    for (VolumeDetail detail : volumeDetails) {
        boolean localSnapSupported = isLocalSnapshotSupported(detail.vpool);
        boolean isRPTargetVolume = isRPTargetVolume(detail.volume);
        boolean isRPSourceVolume = isRPSourceVolume(detail.volume);
        boolean isInConsistencyGroup = isInConsistencyGroup(detail.volume);
        if (isRPSourceVolume || (localSnapSupported && (!isInConsistencyGroup || isRPTargetVolume))) {
            options.add(BlockProvider.createVolumeOption(client, null, detail.volume, volumeNames));
            System.out.println("\t* " + detail.volume.getName());
        } else {
            System.out.println("\t" + detail.volume.getName());
        }
        String extra = String.format("[localSnapSupported: %s, isRPTargetVolume: %s, isRPSourceVolume: %s, isInConsistencyGroup: %s]", localSnapSupported, isRPTargetVolume, isRPSourceVolume, isInConsistencyGroup);
        System.out.println(String.format("\t\tpersonality:[ %s ], filter:[ %s ]", getVolumePersonality(detail.volume), extra));
    }
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) VolumeDetail(com.emc.sa.asset.providers.BlockProvider.VolumeDetail) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 25 with VolumeRestRep

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

the class TestBlockStorageUtils method prepare.

static List<URI> prepare(ViPRCoreClient client) throws URISyntaxException {
    List<URI> returnList = new ArrayList<>();
    ProjectRestRep project = client.projects().get(new URI("urn:storageos:Project:3e1ef32b-3091-4a83-9fac-4a2a3bc30413:global"));
    for (BlockSnapshotRestRep r : client.blockSnapshots().findByProject(project)) {
        returnList.add(r.getId());
    }
    for (VolumeRestRep r : client.blockVolumes().findByProject(project)) {
        returnList.add(r.getId());
    }
    return returnList;
}
Also used : BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) ArrayList(java.util.ArrayList) ProjectRestRep(com.emc.storageos.model.project.ProjectRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Aggregations

VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)136 URI (java.net.URI)74 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)49 Asset (com.emc.sa.asset.annotation.Asset)35 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)35 ArrayList (java.util.ArrayList)25 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)23 AssetOption (com.emc.vipr.model.catalog.AssetOption)20 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)13 HashSet (java.util.HashSet)13 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)12 Test (org.junit.Test)12 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)11 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)9 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 VolumeCreate (com.emc.storageos.model.block.VolumeCreate)7 List (java.util.List)7 SnapshotList (com.emc.storageos.model.SnapshotList)6