Search in sources :

Example 76 with Asset

use of com.emc.sa.asset.annotation.Asset 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 77 with Asset

use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.

the class BlockProvider method getExportPathStorageSystem.

@Asset("exportPathStorageSystem")
public List<AssetOption> getExportPathStorageSystem(AssetOptionsContext ctx) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> options = Lists.newArrayList();
    List<StorageSystemRestRep> storageSystems = client.storageSystems().getAll();
    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) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) Asset(com.emc.sa.asset.annotation.Asset)

Example 78 with Asset

use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.

the class BlockProvider method getApplicationFullCopyNames.

@Asset("fullCopyName")
@AssetDependencies("application")
public List<AssetOption> getApplicationFullCopyNames(AssetOptionsContext ctx, URI applicationId) {
    List<VolumeRestRep> fullCopies = getFullCopiesForApplication(ctx, applicationId);
    Set<String> fullCopyNames = new HashSet<String>();
    for (VolumeRestRep vol : fullCopies) {
        if (vol != null && vol.getProtection() != null && vol.getProtection().getFullCopyRep() != null && vol.getProtection().getFullCopyRep().getFullCopySetName() != null) {
            fullCopyNames.add(vol.getProtection().getFullCopyRep().getFullCopySetName());
        }
    }
    return createStringOptions(fullCopyNames);
}
Also used : VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 79 with Asset

use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.

the class BlockProvider method getUnexportedSourceVolumesWithDeletion.

@Asset("unexportedSourceBlockVolumeWithDeletion")
@AssetDependencies({ "project", "deletionType" })
public List<AssetOption> getUnexportedSourceVolumesWithDeletion(final AssetOptionsContext ctx, URI project, String deletionType) {
    debug("getting unexported source block volumes (project=%s)", project);
    final ViPRCoreClient client = api(ctx);
    Set<URI> volumeIds = new HashSet<URI>(getExportedVolumeIds(ctx, project));
    UnexportedBlockResourceFilter<VolumeRestRep> unexportedFilter = new UnexportedBlockResourceFilter<VolumeRestRep>(volumeIds);
    List<VolumeRestRep> volumes = listSourceVolumes(client, project, unexportedFilter);
    return createVolumeOptions(null, volumes);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) URI(java.net.URI) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 80 with Asset

use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.

the class BlockProvider method getExportVolumePortGroups.

@Asset("exportVolumePortGroups")
@AssetDependencies({ "unassignedBlockVolume", "host", "project" })
public List<AssetOption> getExportVolumePortGroups(AssetOptionsContext ctx, String selectedVolumes, URI hostOrClusterId, URI projectId) {
    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")) {
        List<URI> volumeIds = Lists.newArrayList();
        info("Volumes selected by user: %s", selectedVolumes);
        List<String> parsedVolumeIds = TextUtils.parseCSV(selectedVolumes);
        for (String id : parsedVolumeIds) {
            volumeIds.add(uri(id));
        }
        List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds);
        Set<URI> virtualArrays = new HashSet<URI>();
        Set<URI> storageSystems = new HashSet<URI>();
        Set<URI> virtualPools = new HashSet<URI>();
        for (VolumeRestRep volume : volumes) {
            virtualArrays.add(volume.getVirtualArray().getId());
            storageSystems.add(volume.getStorageController());
            virtualPools.add(volume.getVirtualPool().getId());
        }
        if (virtualArrays.size() == 1 && storageSystems.size() == 1 && virtualPools.size() == 1) {
            Iterator<URI> it = virtualArrays.iterator();
            URI varrayId = it.next();
            ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, varrayId, client);
            Iterator<URI> ssIt = storageSystems.iterator();
            Iterator<URI> vpIt = virtualPools.iterator();
            StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, export != null ? export.getId() : null, ssIt.next(), vpIt.next(), null, true);
            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) URI(java.net.URI) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) HashSet(java.util.HashSet) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

Asset (com.emc.sa.asset.annotation.Asset)119 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)102 AssetOption (com.emc.vipr.model.catalog.AssetOption)74 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)72 URI (java.net.URI)47 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)35 ArrayList (java.util.ArrayList)23 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)17 HashSet (java.util.HashSet)15 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)13 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)10 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)8 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)8 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)8 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6