Search in sources :

Example 71 with VolumeRestRep

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

the class GetBlockResource method executeTask.

@SuppressWarnings("incomplete-switch")
@Override
public BlockObjectRestRep executeTask() throws Exception {
    ViPRCoreClient client = getClient();
    ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
    switch(volumeType) {
        case VOLUME:
            VolumeRestRep volume = client.blockVolumes().get(resourceId);
            if (volume != null) {
                return volume;
            }
            break;
        case BLOCK_SNAPSHOT:
            BlockSnapshotRestRep snapshot = client.blockSnapshots().get(resourceId);
            if (snapshot != null) {
                return snapshot;
            }
            break;
    }
    throw stateException("GetBlockResource.illegalState.notFound", resourceId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) ResourceType(com.emc.sa.util.ResourceType) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Example 72 with VolumeRestRep

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

the class GetMobilityGroupVolumesByCluster method executeTask.

@Override
public Set<URI> executeTask() throws Exception {
    Set<URI> mobilityGroupVolumes = Sets.newHashSet();
    Set<URI> volumes = getHostExportedVolumes();
    for (URI volume : volumes) {
        VolumeRestRep vol = getClient().blockVolumes().get(volume);
        StorageSystemRestRep storage = getClient().storageSystems().get(vol.getStorageController());
        if (BlockStorageUtils.isVplexVolume(vol, storage.getSystemType())) {
            mobilityGroupVolumes.add(volume);
        }
    }
    return mobilityGroupVolumes;
}
Also used : StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 73 with VolumeRestRep

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

the class AddVolumesToConsistencyGroupService method getFullCopies.

/**
 * Get full copies for a given volume id
 *
 * @param volumeId the volume id to use
 * @return list of full copy ids
 */
public List<URI> getFullCopies(URI volumeId) {
    List<URI> fullCopies = Lists.newArrayList();
    List<VolumeRestRep> fullCopyRestReps = execute(new GetActiveFullCopiesForVolume(volumeId));
    for (VolumeRestRep fullCopyId : fullCopyRestReps) {
        fullCopies.add(fullCopyId.getId());
    }
    return fullCopies;
}
Also used : GetActiveFullCopiesForVolume(com.emc.sa.service.vipr.block.tasks.GetActiveFullCopiesForVolume) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 74 with VolumeRestRep

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

the class BlockStorageUtils method createMultipleVolumes.

public static List<URI> createMultipleVolumes(List<? extends CreateBlockVolumeHelper> helpers) {
    Tasks<VolumeRestRep> tasks = execute(new CreateMultipleBlockVolumes(helpers));
    List<URI> volumeIds = Lists.newArrayList();
    for (Task<VolumeRestRep> task : tasks.getTasks()) {
        URI volumeId = task.getResourceId();
        addAffectedResource(volumeId);
        volumeIds.add(volumeId);
    }
    addRollback(new DeactivateVolumes(volumeIds, VolumeDeleteTypeEnum.FULL));
    return volumeIds;
}
Also used : DeactivateVolumes(com.emc.sa.service.vipr.block.tasks.DeactivateVolumes) CreateMultipleBlockVolumes(com.emc.sa.service.vipr.block.tasks.CreateMultipleBlockVolumes) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI)

Example 75 with VolumeRestRep

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

the class BlockStorageUtils method addJournalCapacity.

public static List<URI> addJournalCapacity(URI projectId, URI virtualArrayId, URI virtualPoolId, double sizeInGb, Integer count, URI consistencyGroupId, String copyName) {
    String volumeSize = gbToVolumeSize(sizeInGb);
    Tasks<VolumeRestRep> tasks = execute(new AddJournalCapacity(virtualPoolId, virtualArrayId, projectId, volumeSize, count, consistencyGroupId, copyName));
    List<URI> volumeIds = Lists.newArrayList();
    for (Task<VolumeRestRep> task : tasks.getTasks()) {
        URI volumeId = task.getResourceId();
        addAffectedResource(volumeId);
        volumeIds.add(volumeId);
    }
    return volumeIds;
}
Also used : AddJournalCapacity(com.emc.sa.service.vipr.block.tasks.AddJournalCapacity) 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