Search in sources :

Example 86 with TaskList

use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.

the class RPBlockServiceApiImpl method rpVPlexGroupedMigrations.

/**
 * Calls out to the VPLEX Block Service to group any volumes in RG and migrate
 * the volumes together. If there are any volumes not in RGs they are returned
 * and then added to the single migration container to be migrated later.
 *
 * @param volumesToMigrate All volumes to migrate
 * @param singleMigrations Container to keep track of single migrations
 * @param type Personality type for logging
 * @param logMigrations Log buffer
 * @param taskList List of tasks that will be returned to user
 * @param vpoolChangeParam used to determine if we should suspend on migration commit
 */
private void rpVPlexGroupedMigrations(HashMap<VirtualPool, List<Volume>> volumesToMigrate, Map<Volume, VirtualPool> singleMigrations, String type, StringBuffer logMigrations, TaskList taskList, VirtualPoolChangeParam vpoolChangeParam) {
    for (Map.Entry<VirtualPool, List<Volume>> entry : volumesToMigrate.entrySet()) {
        // List to hold volumes that are grouped by RG and migrated together
        List<Volume> volumesInRG = new ArrayList<Volume>();
        // List to hold volumes that are not grouped by RG and will be migrated as single migrations
        List<Volume> volumesNotInRG = new ArrayList<Volume>();
        VirtualPool migrateToVpool = entry.getKey();
        List<Volume> migrateVolumes = entry.getValue();
        ControllerOperationValuesWrapper operationsWrapper = new ControllerOperationValuesWrapper();
        operationsWrapper.put(ControllerOperationValuesWrapper.MIGRATION_SUSPEND_BEFORE_COMMIT, vpoolChangeParam.getMigrationSuspendBeforeCommit());
        operationsWrapper.put(ControllerOperationValuesWrapper.MIGRATION_SUSPEND_BEFORE_DELETE_SOURCE, vpoolChangeParam.getMigrationSuspendBeforeDeleteSource());
        TaskList taskList2 = vplexBlockServiceApiImpl.migrateVolumesInReplicationGroup(migrateVolumes, migrateToVpool, volumesNotInRG, volumesInRG, operationsWrapper);
        taskList.getTaskList().addAll(taskList2.getTaskList());
        for (Volume volumeInRG : volumesInRG) {
            logMigrations.append(String.format("\tRP+VPLEX migrate %s [%s](%s) to vpool [%s](%s) - GROUPED BY RG\n", type, volumeInRG.getLabel(), volumeInRG.getId(), migrateToVpool.getLabel(), migrateToVpool.getId()));
        }
        for (Volume volumeNotInRG : volumesNotInRG) {
            logMigrations.append(String.format("\tRP+VPLEX migrate %s [%s](%s) to vpool [%s](%s)\n", type, volumeNotInRG.getLabel(), volumeNotInRG.getId(), migrateToVpool.getLabel(), migrateToVpool.getId()));
            singleMigrations.put(volumeNotInRG, migrateToVpool);
        }
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) VolumeGroupVolumeList(com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) List(java.util.List) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Map(java.util.Map) OpStatusMap(com.emc.storageos.db.client.model.OpStatusMap) HashMap(java.util.HashMap) ControllerOperationValuesWrapper(com.emc.storageos.volumecontroller.impl.utils.ControllerOperationValuesWrapper)

Example 87 with TaskList

use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.

the class RestoreSnapshotSessionForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotSessionRestoreParam input = new VolumeGroupSnapshotSessionRestoreParam();
    input.setSnapshotSessions(snapSessions);
    input.setPartial(true);
    TaskList taskList = getClient().application().restoreApplicationSnapshotSession(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : VolumeGroupSnapshotSessionRestoreParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRestoreParam) WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList)

Example 88 with TaskList

use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.

the class RestoreSnapshotForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotOperationParam input = new VolumeGroupSnapshotOperationParam();
    input.setSnapshots(snapshots);
    input.setPartial(true);
    TaskList taskList = getClient().application().restoreApplicationSnapshot(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) VolumeGroupSnapshotOperationParam(com.emc.storageos.model.application.VolumeGroupSnapshotOperationParam)

Example 89 with TaskList

use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.

the class UnlinkSnapshotSessionForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotSessionUnlinkTargetsParam input = new VolumeGroupSnapshotSessionUnlinkTargetsParam();
    input.setSnapshotSessions(snapshotSessions);
    input.setPartial(true);
    List<SnapshotSessionUnlinkTargetParam> linkedTargets = Lists.newArrayList();
    if (existingLinkedSnapshotIds != null) {
        for (String linkedSnapshot : existingLinkedSnapshotIds) {
            SnapshotSessionUnlinkTargetParam param = new SnapshotSessionUnlinkTargetParam();
            param.setId(uri(linkedSnapshot));
            if (deleteTarget != null) {
                param.setDeleteTarget(deleteTarget);
            }
            linkedTargets.add(param);
        }
    }
    input.setLinkedTargets(linkedTargets);
    TaskList taskList = getClient().application().unlinkApplicationSnapshotSession(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) SnapshotSessionUnlinkTargetParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetParam) TaskList(com.emc.storageos.model.TaskList) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)

Example 90 with TaskList

use of com.emc.storageos.model.TaskList in project coprhd-controller by CoprHD.

the class DeleteSnapshotForApplication method doExecute.

@Override
protected Tasks<TaskResourceRep> doExecute() throws Exception {
    VolumeGroupSnapshotOperationParam input = new VolumeGroupSnapshotOperationParam();
    input.setPartial(true);
    input.setSnapshots(snapshots);
    TaskList taskList = getClient().application().deactivateApplicationSnapshot(applicationId, input);
    return new Tasks<TaskResourceRep>(getClient().auth().getClient(), taskList.getTaskList(), TaskResourceRep.class);
}
Also used : WaitForTasks(com.emc.sa.service.vipr.tasks.WaitForTasks) Tasks(com.emc.vipr.client.Tasks) TaskList(com.emc.storageos.model.TaskList) VolumeGroupSnapshotOperationParam(com.emc.storageos.model.application.VolumeGroupSnapshotOperationParam)

Aggregations

TaskList (com.emc.storageos.model.TaskList)161 ArrayList (java.util.ArrayList)84 URI (java.net.URI)83 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)82 Volume (com.emc.storageos.db.client.model.Volume)67 Produces (javax.ws.rs.Produces)62 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)57 Operation (com.emc.storageos.db.client.model.Operation)55 POST (javax.ws.rs.POST)55 Path (javax.ws.rs.Path)54 Consumes (javax.ws.rs.Consumes)44 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)43 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)35 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)33 NamedURI (com.emc.storageos.db.client.model.NamedURI)28 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)27 NullColumnValueGetter.isNullURI (com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI)27 Tasks (com.emc.vipr.client.Tasks)27 List (java.util.List)26 WaitForTasks (com.emc.sa.service.vipr.tasks.WaitForTasks)23