Search in sources :

Example 1 with ChangeBlockVolumeVirtualPoolNoWait

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

the class MobilityGroupMigrationService method execute.

@Override
public void execute() throws Exception {
    boolean migrationTasksFailed = false;
    if (mobilityGroupMethod != null && mobilityGroupMethod.equalsIgnoreCase(BlockProvider.INGEST_AND_MIGRATE_OPTION_KEY)) {
        ingestVolumes();
    }
    List<Task<VolumeRestRep>> tasks = new ArrayList<>();
    Tasks<VolumeRestRep> migrationTasks = execute(new ChangeBlockVolumeVirtualPoolNoWait(mapVpoolVolumes(), targetVirtualPool));
    tasks.addAll(migrationTasks.getTasks());
    if (tasks.isEmpty()) {
        ExecutionUtils.fail("failTask.mobilityGroupMigration.noVolumesMigrated", new Object[] {}, new Object[] {});
    }
    while (!tasks.isEmpty()) {
        waitAndRefresh(tasks);
        for (Task<VolumeRestRep> successfulTask : ComputeUtils.getSuccessfulTasks(tasks)) {
            URI volumeId = successfulTask.getResourceId();
            addAffectedResource(volumeId);
            tasks.remove(successfulTask);
        }
        for (Task<VolumeRestRep> failedTask : ComputeUtils.getFailedTasks(tasks)) {
            String errorMessage = failedTask.getMessage() == null ? "" : failedTask.getMessage();
            ExecutionUtils.currentContext().logError("mobilityGroupMigration.changeVirtualPool.failure", failedTask.getResource().getName(), errorMessage);
            tasks.remove(failedTask);
            migrationTasksFailed = true;
        }
    }
    if (migrationTasksFailed) {
        ExecutionUtils.fail("failTask.MobilityGroupMigration.migrationsFailed", new Object[] {}, new Object[] {});
    }
}
Also used : Task(com.emc.vipr.client.Task) ArrayList(java.util.ArrayList) ChangeBlockVolumeVirtualPoolNoWait(com.emc.sa.service.vipr.block.tasks.ChangeBlockVolumeVirtualPoolNoWait) VolumeRestRep(com.emc.storageos.model.block.VolumeRestRep) UnManagedVolumeRestRep(com.emc.storageos.model.block.UnManagedVolumeRestRep) URI(java.net.URI)

Aggregations

ChangeBlockVolumeVirtualPoolNoWait (com.emc.sa.service.vipr.block.tasks.ChangeBlockVolumeVirtualPoolNoWait)1 UnManagedVolumeRestRep (com.emc.storageos.model.block.UnManagedVolumeRestRep)1 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)1 Task (com.emc.vipr.client.Task)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1