Search in sources :

Example 1 with ExportBlockParam

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

the class BlockExportGroupVolumesDataTable method fetch.

public static List<Volume> fetch(URI exportGroupID) {
    if (exportGroupID == null) {
        return Collections.emptyList();
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportGroupRestRep exportGroup = client.blockExports().get(exportGroupID);
    List<Volume> volumes = Lists.newArrayList();
    for (ExportBlockParam exportBlockParam : exportGroup.getVolumes()) {
        if (ResourceType.isType(VOLUME, exportBlockParam.getId())) {
            volumes.add(new Volume(client.blockVolumes().get(exportBlockParam.getId()), exportBlockParam));
        }
    }
    return volumes;
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep)

Example 2 with ExportBlockParam

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

the class BlockProvider method getExportedBlockContinuousCopyByVolume.

@Asset("exportedBlockContinuousCopy")
@AssetDependencies({ "project", "volumeWithContinuousCopies" })
public List<AssetOption> getExportedBlockContinuousCopyByVolume(AssetOptionsContext ctx, URI project, URI volume) {
    debug("getting exported blockContinuousCopy (project=%s) (parent=%s)", project, volume);
    final ViPRCoreClient client = api(ctx);
    Set<URI> exportedMirrors = new HashSet<URI>();
    for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
        for (ExportBlockParam resource : export.getVolumes()) {
            if (ResourceType.isType(ResourceType.BLOCK_CONTINUOUS_COPY, resource.getId())) {
                exportedMirrors.add(resource.getId());
            }
        }
    }
    ExportedBlockResourceFilter<BlockMirrorRestRep> exportedMirrorFilter = new ExportedBlockResourceFilter<BlockMirrorRestRep>(exportedMirrors);
    List<BlockMirrorRestRep> mirrors = client.blockVolumes().getContinuousCopies(volume, exportedMirrorFilter);
    return createVolumeOptions(client, mirrors);
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) BlockMirrorRestRep(com.emc.storageos.model.block.BlockMirrorRestRep) URI(java.net.URI) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 3 with ExportBlockParam

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

the class BlockProvider method getExportedVolumeIds.

/**
 * Return a list of all exported volume ids for a given project id.
 *
 * @param ctx asset option content
 * @param project id
 * @return list of exported volume ids
 */
private List<URI> getExportedVolumeIds(AssetOptionsContext ctx, URI project) {
    final ViPRCoreClient client = api(ctx);
    List<URI> volumeIds = Lists.newArrayList();
    for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
        for (ExportBlockParam resource : export.getVolumes()) {
            if (ResourceType.isType(ResourceType.VOLUME, resource.getId())) {
                volumeIds.add(resource.getId());
            }
        }
    }
    return volumeIds;
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) URI(java.net.URI)

Example 4 with ExportBlockParam

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

the class BlockProvider method getExportedBlockSnapshotsByVolume.

@Asset("exportedBlockSnapshot")
@AssetDependencies({ "project" })
public List<AssetOption> getExportedBlockSnapshotsByVolume(AssetOptionsContext ctx, URI project) {
    debug("getting exported blockSnapshots (project=%s)", project);
    final ViPRCoreClient client = api(ctx);
    List<URI> snapshotIds = Lists.newArrayList();
    for (ExportGroupRestRep export : client.blockExports().findByProject(project)) {
        for (ExportBlockParam resource : export.getVolumes()) {
            if (ResourceType.isType(ResourceType.BLOCK_SNAPSHOT, resource.getId())) {
                snapshotIds.add(resource.getId());
            }
        }
    }
    List<BlockSnapshotRestRep> snapshots = client.blockSnapshots().getByIds(snapshotIds);
    return createVolumeWithVarrayOptions(client, snapshots);
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 5 with ExportBlockParam

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

the class BlockProvider method getExportPathStorageSystem.

@SuppressWarnings("incomplete-switch")
@Asset("exportPathStorageSystem")
@AssetDependencies({ "exportPathExport" })
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx, URI exportId) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<URI> storageSystemIds = new ArrayList<URI>();
    ExportGroupRestRep export = client.blockExports().get(exportId);
    List<ExportBlockParam> volumes = export.getVolumes();
    for (ExportBlockParam volume : volumes) {
        URI resourceId = volume.getId();
        ResourceType volumeType = ResourceType.fromResourceId(resourceId.toString());
        switch(volumeType) {
            case VOLUME:
                VolumeRestRep v = client.blockVolumes().get(resourceId);
                if (v != null) {
                    storageSystemIds.add(v.getStorageController());
                }
                break;
            case BLOCK_SNAPSHOT:
                BlockSnapshotRestRep s = client.blockSnapshots().get(resourceId);
                if (s != null) {
                    storageSystemIds.add(s.getStorageController());
                }
                break;
        }
    }
    List<StorageSystemRestRep> storageSystems = client.storageSystems().getByIds(storageSystemIds);
    for (StorageSystemRestRep storageSystem : storageSystems) {
        String systemType = storageSystem.getSystemType();
        if (Type.vmax.name().equalsIgnoreCase(systemType) || Type.vplex.name().equalsIgnoreCase(systemType)) {
            options.add(new AssetOption(storageSystem.getId(), storageSystem.getName()));
        }
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) ResourceType(com.emc.sa.util.ResourceType) URI(java.net.URI) ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

ExportBlockParam (com.emc.storageos.model.block.export.ExportBlockParam)7 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)7 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 URI (java.net.URI)4 Asset (com.emc.sa.asset.annotation.Asset)3 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)3 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)3 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)2 ArrayList (java.util.ArrayList)2 ResourceType (com.emc.sa.util.ResourceType)1 Cluster (com.emc.storageos.db.client.model.Cluster)1 ExportPathParams (com.emc.storageos.db.client.model.ExportPathParams)1 Host (com.emc.storageos.db.client.model.Host)1 Initiator (com.emc.storageos.db.client.model.Initiator)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 StringHashMapEntry (com.emc.storageos.model.StringHashMapEntry)1 BlockMirrorRestRep (com.emc.storageos.model.block.BlockMirrorRestRep)1 ExportPathParametersRep (com.emc.storageos.model.block.export.ExportPathParametersRep)1 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)1 AssetOption (com.emc.vipr.model.catalog.AssetOption)1