Search in sources :

Example 1 with GetUnmanagedVolumesByHostOrCluster

use of com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster in project coprhd-controller by CoprHD.

the class IngestExportedUnmanagedVolumesService method execute.

@Override
public void execute() throws Exception {
    if (ingestionMethod == null || ingestionMethod.isEmpty()) {
        ingestionMethod = IngestionMethodEnum.FULL.toString();
    }
    int succeed = execute(new IngestExportedUnmanagedVolumes(virtualPool, virtualArray, project, host == null ? null : host.getId(), cluster == null ? null : cluster.getId(), uris(volumeIds), ingestionMethod)).getTasks().size();
    logInfo("ingest.exported.unmanaged.volume.service.ingested", succeed);
    logInfo("ingest.exported.unmanaged.volume.service.skipped", volumeIds.size() - succeed);
    int remaining = execute(new GetUnmanagedVolumesByHostOrCluster(host != null ? host.getId() : cluster.getId())).size();
    logInfo("ingest.exported.unmanaged.volume.service.remaining", remaining);
}
Also used : IngestExportedUnmanagedVolumes(com.emc.sa.service.vipr.block.tasks.IngestExportedUnmanagedVolumes) GetUnmanagedVolumesByHostOrCluster(com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster)

Example 2 with GetUnmanagedVolumesByHostOrCluster

use of com.emc.sa.service.vipr.block.tasks.GetUnmanagedVolumesByHostOrCluster 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

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