Search in sources :

Example 1 with ResourceOperationTypeEnum

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

the class ArrayAffinityDataCollectionTaskCompleter method createDefaultOperation.

@Override
protected void createDefaultOperation(DbClient dbClient) {
    ResourceOperationTypeEnum opType = ResourceOperationTypeEnum.ARRAYAFFINITY_STORAGE_SYSTEM;
    Class type = getType();
    String opId = getOpId();
    for (URI id : getIds()) {
        dbClient.createTaskOpStatus(type, id, opId, opType);
    }
}
Also used : ResourceOperationTypeEnum(com.emc.storageos.model.ResourceOperationTypeEnum) URI(java.net.URI)

Example 2 with ResourceOperationTypeEnum

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

the class DiscoverTaskCompleter method createDefaultOperation.

@Override
protected void createDefaultOperation(DbClient dbClient) {
    ResourceOperationTypeEnum opType = ResourceOperationTypeEnum.DISCOVER_STORAGE_SYSTEM;
    Class type = getType();
    if (Host.class.equals(type)) {
        opType = ResourceOperationTypeEnum.DISCOVER_HOST;
    } else if (Vcenter.class.equals(type)) {
        opType = ResourceOperationTypeEnum.DISCOVER_VCENTER;
    } else if (ComputeSystem.class.equals(type)) {
        opType = ResourceOperationTypeEnum.DISCOVER_COMPUTE_SYSTEM;
    } else if (NetworkSystem.class.equals(type)) {
        opType = ResourceOperationTypeEnum.DISCOVER_NETWORK_SYSTEM;
    } else if (ProtectionSet.class.equals(type)) {
        opType = ResourceOperationTypeEnum.DISCOVER_PROTECTION_SET;
    }
    dbClient.createTaskOpStatus(getType(), getId(), getOpId(), opType);
}
Also used : Vcenter(com.emc.storageos.db.client.model.Vcenter) ResourceOperationTypeEnum(com.emc.storageos.model.ResourceOperationTypeEnum) NetworkSystem(com.emc.storageos.db.client.model.NetworkSystem)

Example 3 with ResourceOperationTypeEnum

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

the class RPBlockServiceApiImpl method createTaskForVolume.

/**
 * Used to create a task and add it to the TaskList
 *
 * @param volume
 *            Volume that the task is for
 * @param capabilities
 * @param taskList
 *            The TaskList to store tasks
 * @param task
 *            Task Id
 */
private void createTaskForVolume(Volume volume, VirtualPoolCapabilityValuesWrapper capabilities, TaskList taskList, String task) {
    ResourceOperationTypeEnum type = ResourceOperationTypeEnum.CREATE_BLOCK_VOLUME;
    if (capabilities.getAddJournalCapacity()) {
        type = ResourceOperationTypeEnum.ADD_JOURNAL_VOLUME;
    }
    createTaskForVolume(volume, type, taskList, task);
}
Also used : ResourceOperationTypeEnum(com.emc.storageos.model.ResourceOperationTypeEnum)

Example 4 with ResourceOperationTypeEnum

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

the class VolumeGroupService method performVolumeGroupSnapshotSessionOperation.

/*
     * Wrapper of BlockConsistencyGroupService methods for snapshot session operations
     * 
     * @param volumeGroupId
     * 
     * @param param
     * 
     * @return a TaskList
     */
private TaskList performVolumeGroupSnapshotSessionOperation(final URI volumeGroupId, final VolumeGroupSnapshotSessionOperationParam param, OperationTypeEnum opType) {
    List<BlockSnapshotSession> snapSessions = getSnapshotSessionsGroupedBySnapSessionset(volumeGroupId, param);
    // Check for pending tasks
    VolumeGroup volumeGroup = _dbClient.queryObject(VolumeGroup.class, volumeGroupId);
    if (opType == OperationTypeEnum.RESTORE_VOLUME_GROUP_SNAPSHOT_SESSION) {
        checkForApplicationPendingTasks(volumeGroup, _dbClient, true);
    } else {
        checkForApplicationPendingTasks(volumeGroup, _dbClient, false);
    }
    auditOp(opType, true, AuditLogManager.AUDITOP_BEGIN, volumeGroupId.toString(), param.getSnapshotSessions());
    TaskList taskList = new TaskList();
    Table<URI, String, BlockSnapshotSession> storageRgToSnapshot = ControllerUtils.getSnapshotSessionForStorageReplicationGroup(snapSessions, _dbClient);
    for (Cell<URI, String, BlockSnapshotSession> cell : storageRgToSnapshot.cellSet()) {
        BlockSnapshotSession session = cell.getValue();
        log.info("{} for replication group {}", opType.getDescription(), cell.getColumnKey());
        ResourceOperationTypeEnum oprEnum = null;
        try {
            // should not be null
            URI cgUri = session.getConsistencyGroup();
            URI sessionUri = session.getId();
            log.info("CG: {}, Session: {}", cgUri, session.getLabel());
            switch(opType) {
                case RESTORE_VOLUME_GROUP_SNAPSHOT_SESSION:
                    oprEnum = ResourceOperationTypeEnum.RESTORE_SNAPSHOT_SESSION;
                    taskList.addTask(_blockConsistencyGroupService.restoreConsistencyGroupSnapshotSession(cgUri, sessionUri));
                    break;
                case DELETE_VOLUME_GROUP_SNAPSHOT_SESSION:
                    oprEnum = ResourceOperationTypeEnum.DELETE_CONSISTENCY_GROUP_SNAPSHOT_SESSION;
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.deactivateConsistencyGroupSnapshotSession(cgUri, sessionUri).getTaskList());
                    break;
                case LINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.LINK_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionLinkTargetsParam linkParam = new SnapshotSessionLinkTargetsParam(((VolumeGroupSnapshotSessionLinkTargetsParam) param).getNewLinkedTargets());
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.linkTargetVolumes(cgUri, sessionUri, linkParam).getTaskList());
                    break;
                case RELINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.RELINK_CONSISTENCY_GROUP_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionRelinkTargetsParam relinkParam = new SnapshotSessionRelinkTargetsParam(getRelinkTargetIdsForSession((VolumeGroupSnapshotSessionRelinkTargetsParam) param, session, snapSessions.size()));
                    taskList.getTaskList().addAll(_blockConsistencyGroupService.relinkTargetVolumes(cgUri, sessionUri, relinkParam).getTaskList());
                    break;
                case UNLINK_VOLUME_GROUP_SNAPSHOT_SESSION_TARGET:
                    oprEnum = ResourceOperationTypeEnum.UNLINK_SNAPSHOT_SESSION_TARGETS;
                    SnapshotSessionUnlinkTargetsParam unlinkParam = new SnapshotSessionUnlinkTargetsParam(getUnlinkTargetIdsForSession((VolumeGroupSnapshotSessionUnlinkTargetsParam) param, session));
                    taskList.addTask(_blockConsistencyGroupService.unlinkTargetVolumesForSession(cgUri, sessionUri, unlinkParam));
                    break;
                default:
                    log.error("Unsupported operation {}", opType.getDescription());
                    break;
            }
        } catch (InternalException | APIException e) {
            String errMsg = String.format("Exception occurred while performing %s on Replication group %s", opType.getDescription(), cell.getColumnKey());
            log.error(errMsg, e);
            TaskResourceRep task = BlockServiceUtils.createFailedTaskOnSnapshotSession(_dbClient, session, oprEnum, e);
            taskList.addTask(task);
        } catch (Exception ex) {
            String errMsg = String.format("Unexpected Exception occurred while performing %s on Replication group %s", opType.getDescription(), cell.getColumnKey());
            log.error(errMsg, ex);
        }
    }
    auditOp(opType, true, AuditLogManager.AUDITOP_END, volumeGroupId.toString(), param.getSnapshotSessions());
    return taskList;
}
Also used : BlockSnapshotSession(com.emc.storageos.db.client.model.BlockSnapshotSession) TaskList(com.emc.storageos.model.TaskList) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam) URI(java.net.URI) NullColumnValueGetter.isNullURI(com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) SnapshotSessionLinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionLinkTargetsParam) VolumeGroupSnapshotSessionLinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionLinkTargetsParam) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) VolumeGroup(com.emc.storageos.db.client.model.VolumeGroup) VolumeGroupSnapshotSessionRelinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam) SnapshotSessionRelinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionRelinkTargetsParam) VolumeGroupSnapshotSessionRelinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam) ResourceOperationTypeEnum(com.emc.storageos.model.ResourceOperationTypeEnum) SnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam) VolumeGroupSnapshotSessionUnlinkTargetsParam(com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)

Aggregations

ResourceOperationTypeEnum (com.emc.storageos.model.ResourceOperationTypeEnum)4 URI (java.net.URI)2 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1 NetworkSystem (com.emc.storageos.db.client.model.NetworkSystem)1 Vcenter (com.emc.storageos.db.client.model.Vcenter)1 VolumeGroup (com.emc.storageos.db.client.model.VolumeGroup)1 NullColumnValueGetter.isNullURI (com.emc.storageos.db.client.util.NullColumnValueGetter.isNullURI)1 TaskList (com.emc.storageos.model.TaskList)1 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)1 VolumeGroupSnapshotSessionLinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionLinkTargetsParam)1 VolumeGroupSnapshotSessionRelinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionRelinkTargetsParam)1 VolumeGroupSnapshotSessionUnlinkTargetsParam (com.emc.storageos.model.application.VolumeGroupSnapshotSessionUnlinkTargetsParam)1 SnapshotSessionLinkTargetsParam (com.emc.storageos.model.block.SnapshotSessionLinkTargetsParam)1 SnapshotSessionRelinkTargetsParam (com.emc.storageos.model.block.SnapshotSessionRelinkTargetsParam)1 SnapshotSessionUnlinkTargetsParam (com.emc.storageos.model.block.SnapshotSessionUnlinkTargetsParam)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1