Search in sources :

Example 71 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method getTargetVplexVolumeVirtualArrays.

@Asset("targetVirtualArray")
@AssetDependencies("project")
public List<AssetOption> getTargetVplexVolumeVirtualArrays(AssetOptionsContext ctx, URI projectId) {
    ViPRCoreClient client = api(ctx);
    List<AssetOption> targets = Lists.newArrayList();
    for (VirtualArrayRestRep varray : client.varrays().getByTenant(ctx.getTenant())) {
        targets.add(createBaseResourceOption(varray));
    }
    return targets;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 72 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption 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)

Example 73 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method createExportWithVarrayOptions.

protected static List<AssetOption> createExportWithVarrayOptions(ViPRCoreClient client, Collection<? extends ExportGroupRestRep> exportObjects) {
    List<URI> varrayIds = getExportVirtualArrayIds(exportObjects);
    Map<URI, VirtualArrayRestRep> varrayNames = getVirutalArrayNames(client, varrayIds);
    List<AssetOption> options = Lists.newArrayList();
    for (ExportGroupRestRep export : exportObjects) {
        options.add(createExportWithVarrayOption(export, varrayNames));
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) URI(java.net.URI)

Example 74 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method getPreviewStorageSystem.

@Asset("exportPathPreviewStorageSystem")
@AssetDependencies({ "host", "exportPathVirtualArray", "exportPathExport", "exportPathMinPathsOptions", "exportPathMaxPathsOptions", "exportPathPathsPerInitiatorOptions", "exportPathExistingPath", "exportPathStorageSystem", "exportPathPorts" })
public List<AssetOption> getPreviewStorageSystem(AssetOptionsContext ctx, URI hostOrClusterId, URI vArrayId, URI exportId, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, String useExisting, URI storageSystemId, String ports) {
    List<AssetOption> options = Lists.newArrayList();
    List<URI> exportPathPorts = parseExportPathPorts(ports);
    ExportPathsAdjustmentPreviewRestRep portPreview = generateExportPathPreview(ctx, hostOrClusterId, vArrayId, exportId, minPaths, maxPaths, pathsPerInitiator, useExisting, storageSystemId, exportPathPorts);
    options.add(new AssetOption(portPreview.getStorageSystem(), portPreview.getStorageSystem()));
    return options;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ExportPathsAdjustmentPreviewRestRep(com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewRestRep) URI(java.net.URI) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 75 with AssetOption

use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.

the class BlockProvider method getApplicationVolumes.

@Asset("applicationBlockVolume")
@AssetDependencies("application")
public List<AssetOption> getApplicationVolumes(AssetOptionsContext ctx, URI application) {
    final ViPRCoreClient client = api(ctx);
    List<NamedRelatedResourceRep> volList = client.application().listVolumes(application);
    List<AssetOption> options = new ArrayList<AssetOption>();
    if (volList != null && !volList.isEmpty()) {
        List<VolumeRestRep> allVols = client.blockVolumes().getByRefs(volList);
        Map<String, List<VolumeRestRep>> repGrpVolMap = new HashMap<String, List<VolumeRestRep>>();
        for (VolumeRestRep vol : allVols) {
            if (!BlockProviderUtils.isRPTargetReplicationGroup(vol.getReplicationGroupInstance())) {
                if (repGrpVolMap.get(vol.getReplicationGroupInstance()) == null) {
                    repGrpVolMap.put(vol.getReplicationGroupInstance(), new ArrayList<VolumeRestRep>());
                }
                repGrpVolMap.get(vol.getReplicationGroupInstance()).add(vol);
            }
        }
        for (Entry<String, List<VolumeRestRep>> entry : repGrpVolMap.entrySet()) {
            for (VolumeRestRep vol : entry.getValue()) {
                options.add(new AssetOption(vol.getId(), getMessage("application.volumes.replication_group", vol.getName(), vol.getReplicationGroupInstance())));
            }
        }
    }
    return options;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) BlockSnapshotSessionList(com.emc.storageos.model.block.BlockSnapshotSessionList) StoragePortList(com.emc.storageos.model.ports.StoragePortList) ArrayList(java.util.ArrayList) VolumeGroupList(com.emc.storageos.model.application.VolumeGroupList) List(java.util.List) NamedVolumesList(com.emc.storageos.model.block.NamedVolumesList) SnapshotList(com.emc.storageos.model.SnapshotList) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

AssetOption (com.emc.vipr.model.catalog.AssetOption)107 Asset (com.emc.sa.asset.annotation.Asset)74 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)63 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)41 URI (java.net.URI)36 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)20 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)14 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)14 ArrayList (java.util.ArrayList)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)10 Map (java.util.Map)9 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)8 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)8 HashMap (java.util.HashMap)8 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)6 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)6 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)5