Search in sources :

Example 1 with GetMobilityGroupClusters

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

Aggregations

GetMobilityGroupClusters (com.emc.sa.service.vipr.block.tasks.GetMobilityGroupClusters)1 GetMobilityGroupHosts (com.emc.sa.service.vipr.block.tasks.GetMobilityGroupHosts)1 GetUnmanagedVolumesByHostOrCluster (com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster)1 IngestExportedUnmanagedVolumes (com.emc.sa.service.vipr.block.tasks.IngestExportedUnmanagedVolumes)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)1 URI (java.net.URI)1