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);
}
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);
}
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;
}
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);
}
}
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);
}
Aggregations