Search in sources :

Example 96 with NamedRelatedResourceRep

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

the class BlockSnapshots method snapshotExports.

public static void snapshotExports(String snapshotId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    Map<URI, ExportGroupRestRep> exportGroups = Maps.newHashMap();
    Map<URI, List<ITLRestRep>> exportGroupItlMap = Maps.newHashMap();
    List<ITLRestRep> itls = client.blockSnapshots().listExports(uri(snapshotId));
    for (ITLRestRep itl : itls) {
        NamedRelatedResourceRep export = itl.getExport();
        if (export != null && export.getId() != null) {
            List<ITLRestRep> exportGroupItls = exportGroupItlMap.get(export.getId());
            if (exportGroupItls == null) {
                exportGroupItls = Lists.newArrayList();
                exportGroupItlMap.put(export.getId(), exportGroupItls);
            }
            exportGroupItls.add(itl);
            if (exportGroups.keySet().contains(export.getId()) == false) {
                ExportGroupRestRep exportGroup = client.blockExports().get(export.getId());
                exportGroups.put(exportGroup.getId(), exportGroup);
            }
        }
    }
    render(itls, exportGroups, exportGroupItlMap);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) List(java.util.List) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 97 with NamedRelatedResourceRep

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

the class BlockVolumes method volumeExports.

public static void volumeExports(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    Map<URI, ExportGroupRestRep> exportGroups = Maps.newHashMap();
    Map<URI, List<ITLRestRep>> exportGroupItlMap = Maps.newHashMap();
    List<ITLRestRep> itls = Lists.newArrayList();
    VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
    if (volume != null && volume.getInactive() == false) {
        itls = client.blockVolumes().getExports(uri(volumeId));
        for (ITLRestRep itl : itls) {
            NamedRelatedResourceRep export = itl.getExport();
            if (export != null && export.getId() != null) {
                List<ITLRestRep> exportGroupItls = exportGroupItlMap.get(export.getId());
                if (exportGroupItls == null) {
                    exportGroupItls = Lists.newArrayList();
                    exportGroupItlMap.put(export.getId(), exportGroupItls);
                }
                exportGroupItls.add(itl);
                if (exportGroups.keySet().contains(export.getId()) == false) {
                    ExportGroupRestRep exportGroup = client.blockExports().get(export.getId());
                    exportGroups.put(exportGroup.getId(), exportGroup);
                }
            }
        }
    }
    // Remove 'internal' marked export groups, we don't want to show these in the exports list
    Set<URI> internalExportGroups = Sets.newHashSet();
    for (ExportGroupRestRep exportGroup : exportGroups.values()) {
        if (Boolean.TRUE.equals(exportGroup.getInternal())) {
            internalExportGroups.add(exportGroup.getId());
        }
    }
    // Remove internal export groups
    exportGroups.keySet().removeAll(internalExportGroups);
    // Remove initiators from interal export groups
    exportGroupItlMap.keySet().removeAll(internalExportGroups);
    render(itls, exportGroups, exportGroupItlMap);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) List(java.util.List) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 98 with NamedRelatedResourceRep

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

the class IngestUnmanagedFilesystems method ingestInChunks.

private List<NamedRelatedResourceRep> ingestInChunks(FileSystemIngest ingest) {
    List<NamedRelatedResourceRep> results = Lists.newArrayList();
    int i = 1;
    for (Iterator<URI> ids = unmanagedFilesystemIds.iterator(); ids.hasNext(); ) {
        i++;
        URI id = ids.next();
        ingest.getUnManagedFileSystems().add(id);
        if (i == IngestUnexportedUnmanagedVolumes.INGEST_CHUNK_SIZE || !ids.hasNext()) {
            results.addAll(ingestFilesystems(ingest));
            ingest.getUnManagedFileSystems().clear();
            i = 0;
        }
    }
    return results;
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 99 with NamedRelatedResourceRep

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

the class MobilityGroupMigrationService method ingestVolumes.

private void ingestVolumes() {
    List<NamedRelatedResourceRep> hostsOrClusters = Lists.newArrayList();
    if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.HOSTS.name())) {
        hostsOrClusters = execute(new GetMobilityGroupHosts(mobilityGroup.getId()));
    } else if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.CLUSTERS.name())) {
        hostsOrClusters = execute(new GetMobilityGroupClusters(mobilityGroup.getId()));
    }
    for (NamedRelatedResourceRep hostOrCluster : hostsOrClusters) {
        int remaining = execute(new GetUnmanagedVolumesByHostOrCluster(hostOrCluster.getId())).size();
        logInfo("ingest.exported.unmanaged.volume.service.remaining", remaining);
    }
    for (NamedRelatedResourceRep hostOrCluster : hostsOrClusters) {
        URI host = BlockStorageUtils.isHost(hostOrCluster.getId()) ? hostOrCluster.getId() : null;
        URI cluster = BlockStorageUtils.isCluster(hostOrCluster.getId()) ? hostOrCluster.getId() : null;
        List<UnManagedVolumeRestRep> volumeIds = execute(new GetUnmanagedVolumesByHostOrCluster(hostOrCluster.getId()));
        List<URI> ingestVolumeIds = Lists.newArrayList();
        for (UnManagedVolumeRestRep unmanaged : volumeIds) {
            if (VirtualDataCenterProvider.matchesVpool(unmanaged, virtualPool)) {
                ingestVolumeIds.add(unmanaged.getId());
            }
        }
        int succeed = execute(new IngestExportedUnmanagedVolumes(virtualPool, virtualArray, project, host == null ? null : host, cluster == null ? null : cluster, ingestVolumeIds, IngestionMethodEnum.VIRTUAL_VOLUMES_ONLY.toString())).getTasks().size();
        logInfo("ingest.exported.unmanaged.volume.service.ingested", succeed);
        logInfo("ingest.exported.unmanaged.volume.service.skipped", volumeIds.size() - succeed);
    }
}
Also used : IngestExportedUnmanagedVolumes(com.emc.sa.service.vipr.block.tasks.IngestExportedUnmanagedVolumes) GetMobilityGroupClusters(com.emc.sa.service.vipr.block.tasks.GetMobilityGroupClusters) GetMobilityGroupHosts(com.emc.sa.service.vipr.block.tasks.GetMobilityGroupHosts) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) GetUnmanagedVolumesByHostOrCluster(com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) URI(java.net.URI)

Example 100 with NamedRelatedResourceRep

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

the class BlockVolumes method volumeFullCopies.

public static void volumeFullCopies(String volumeId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    List<NamedRelatedResourceRep> refs = client.blockVolumes().listFullCopies(uri(volumeId));
    List<VolumeRestRep> fullCopies = client.blockVolumes().getByRefs(refs);
    render(fullCopies);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)111 URI (java.net.URI)47 ArrayList (java.util.ArrayList)28 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)22 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)18 Asset (com.emc.sa.asset.annotation.Asset)11 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)11 AssetOption (com.emc.vipr.model.catalog.AssetOption)9 HashMap (java.util.HashMap)8 GET (javax.ws.rs.GET)8 Produces (javax.ws.rs.Produces)8 NamedVolumesList (com.emc.storageos.model.block.NamedVolumesList)7 Path (javax.ws.rs.Path)7 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 SnapshotList (com.emc.storageos.model.SnapshotList)5 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)5 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 HashSet (java.util.HashSet)5 List (java.util.List)5