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