Search in sources :

Example 71 with ViPRCoreClient

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

the class BlockProvider method getLinkedSnapshotsForSnapshotSessionVolume.

@Asset("linkedSnapshotsForVolume")
@AssetDependencies({ "snapshotSessionBlockVolume", "blockVolumeOrConsistencyType" })
public List<AssetOption> getLinkedSnapshotsForSnapshotSessionVolume(AssetOptionsContext ctx, URI volumeOrCGId, String volumeOrConsistencyType) {
    if (!checkTypeConsistency(volumeOrCGId, volumeOrConsistencyType)) {
        warn("Inconsistent types, %s and %s, return empty results", volumeOrCGId, volumeOrConsistencyType);
        return new ArrayList<AssetOption>();
    }
    List<BlockSnapshotRestRep> snapshots = new ArrayList<BlockSnapshotRestRep>();
    List<BlockSnapshotSessionRestRep> snapshotSessions = new ArrayList<BlockSnapshotSessionRestRep>();
    final ViPRCoreClient client = api(ctx);
    if (isVolumeType(volumeOrConsistencyType)) {
        snapshots = client.blockSnapshots().getByVolume(volumeOrCGId, new DefaultResourceFilter<BlockSnapshotRestRep>());
        snapshotSessions = client.blockSnapshotSessions().getByVolume(volumeOrCGId, new DefaultResourceFilter<BlockSnapshotSessionRestRep>());
    } else {
        snapshots = client.blockSnapshots().getByConsistencyGroup(volumeOrCGId, new DefaultResourceFilter<BlockSnapshotRestRep>());
        snapshotSessions = client.blockSnapshotSessions().getByConsistencyGroup(volumeOrCGId, new DefaultResourceFilter<BlockSnapshotSessionRestRep>());
    }
    return constructSnapshotWithSnapshotSessionOptions(snapshots, snapshotSessions);
}
Also used : BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) ArrayList(java.util.ArrayList) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 72 with ViPRCoreClient

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

the class BlockProvider method getRemoteSnapshotBlockVolumes.

@Asset("remoteSnapshotBlockVolume")
@AssetDependencies({ "project" })
public List<AssetOption> getRemoteSnapshotBlockVolumes(AssetOptionsContext context, URI project) {
    final ViPRCoreClient client = api(context);
    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) {
        if (isRemoteSnapshotSupported(detail.volume)) {
            options.add(createVolumeOption(client, null, detail.volume, volumeNames));
        }
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 73 with ViPRCoreClient

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

the class BlockProvider method getVolumeSnapshotSessionOptionsForProject.

/**
 * get single volume snapshot sessions for a project
 * @param ctx
 * @param project
 * @return
 */
private List<AssetOption> getVolumeSnapshotSessionOptionsForProject(AssetOptionsContext ctx, URI project) {
    final ViPRCoreClient client = api(ctx);
    List<BlockSnapshotSessionRestRep> snapshotSessions = client.blockSnapshotSessions().findByProject(project);
    List<BlockSnapshotSessionRestRep> singleVolumeSnapshotSessions = new ArrayList<BlockSnapshotSessionRestRep>();
    for (BlockSnapshotSessionRestRep snapshotSession : snapshotSessions) {
        if (snapshotSession.getReplicationGroupInstance() == null) {
            singleVolumeSnapshotSessions.add(snapshotSession);
        }
    }
    return constructSnapshotSessionOptions(client, project, singleVolumeSnapshotSessions);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotSessionRestRep(com.emc.storageos.model.block.BlockSnapshotSessionRestRep) ArrayList(java.util.ArrayList)

Example 74 with ViPRCoreClient

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

the class BlockProvider method getCurrentExportPortGroups.

@Asset("exportCurrentPortGroup")
@AssetDependencies({ "host", "exportPathExport", "exportPathStorageSystem", "exportPathVirtualArray" })
public List<AssetOption> getCurrentExportPortGroups(AssetOptionsContext ctx, URI hostOrClusterId, URI exportId, URI storageSystemId, URI varrayId) {
    final ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
    if (value.getValue().equalsIgnoreCase("true")) {
        StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, exportId, storageSystemId, null, null, false);
        return createPortGroupOptions(portGroups.getStoragePortGroups());
    }
    return options;
}
Also used : SimpleValueRep(com.emc.storageos.model.customconfig.SimpleValueRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 75 with ViPRCoreClient

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

the class BlockProvider method getExportedVolumes.

@Asset("exportedBlockVolume")
@AssetDependencies("project")
public List<AssetOption> getExportedVolumes(AssetOptionsContext ctx, URI project) {
    debug("getting source block volumes (project=%s)", project);
    final ViPRCoreClient client = api(ctx);
    // Filter volumes that are not RP Metadata
    List<URI> volumeIds = getExportedVolumeIds(ctx, project);
    FilterChain<VolumeRestRep> filter = new FilterChain<VolumeRestRep>(RecoverPointPersonalityFilter.METADATA.not());
    filter.and(new BlockVolumeVMFSDatastoreFilter().not());
    filter.and(new BlockVolumeBootVolumeFilter().not());
    filter.and(new BlockVolumeMountPointFilter().not());
    List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds, filter);
    return createVolumeWithVarrayOptions(client, volumes);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) FilterChain(com.emc.vipr.client.core.filters.FilterChain) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) BlockVolumeBootVolumeFilter(com.emc.vipr.client.core.filters.BlockVolumeBootVolumeFilter) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

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