use of com.emc.sa.service.vipr.block.tasks.GetMobilityGroupClusters 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);
}
}
Aggregations