Search in sources :

Example 1 with SRDFTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter in project coprhd-controller by CoprHD.

the class SRDFDeviceController method removePairFromGroup.

public boolean removePairFromGroup(final URI systemURI, final URI sourceURI, final URI targetURI, final boolean rollback, final String opId) {
    log.info("START Remove Pair from Group");
    TaskCompleter completer = null;
    try {
        WorkflowStepCompleter.stepExecuting(opId);
        StorageSystem system = getStorageSystem(systemURI);
        dbClient.queryObject(Volume.class, targetURI);
        completer = new SRDFTaskCompleter(sourceURI, targetURI, opId);
        getRemoteMirrorDevice().doRemoveVolumePair(system, sourceURI, targetURI, rollback, completer);
    } catch (Exception e) {
        return completeAsError(completer, DeviceControllerException.errors.jobFailed(e), opId);
    }
    return true;
}
Also used : SRDFChangeCopyModeTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFChangeCopyModeTaskCompleter) TaskCompleter(com.emc.storageos.volumecontroller.TaskCompleter) NullTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.NullTaskCompleter) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) WorkflowException(com.emc.storageos.workflow.WorkflowException) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) LockRetryException(com.emc.storageos.locking.LockRetryException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 2 with SRDFTaskCompleter

use of com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter in project coprhd-controller by CoprHD.

the class SRDFOperations method removeDeviceGroups.

/**
 * Removes the source and target from their device groups, which should in turn remove the
 * group.
 *
 * @param system
 * @param sourceURI
 * @param targetURI
 * @param completer
 */
public void removeDeviceGroups(final StorageSystem system, final URI sourceURI, final URI targetURI, final boolean isVpoolChange, TaskCompleter completer) {
    log.info("START removing device groups");
    StorageSystem targetSystem = null;
    Volume source = null;
    Volume target = null;
    try {
        if (null == completer) {
            completer = new SRDFTaskCompleter(sourceURI, targetURI, "remove volume from device group");
        }
        source = dbClient.queryObject(Volume.class, sourceURI);
        target = dbClient.queryObject(Volume.class, targetURI);
        targetSystem = dbClient.queryObject(StorageSystem.class, target.getStorageController());
        BlockConsistencyGroup targetCG = dbClient.queryObject(BlockConsistencyGroup.class, target.getConsistencyGroup());
        BlockConsistencyGroup sourceCG = dbClient.queryObject(BlockConsistencyGroup.class, source.getConsistencyGroup());
        boolean cgSourceCleanUpRequired = false;
        if (!isVpoolChange) {
            cgSourceCleanUpRequired = removeFromDeviceGroups(system, system, source, sourceCG);
        }
        boolean cgTargetCleanUpRequired = removeFromDeviceGroups(targetSystem, system, target, targetCG);
        // after volumes are deleted .group gets removed
        if (cgSourceCleanUpRequired || cgTargetCleanUpRequired) {
            SRDFUtils.cleanUpSourceAndTargetCGs(sourceCG, targetCG, system.getId(), isVpoolChange, dbClient);
        }
    } catch (Exception e) {
        String msg = format(FAILURE_MSG_FMT, "remove srdf replication groups for ", sourceURI, targetURI);
        log.warn(msg, e);
    } finally {
        // update DB objects
        // this step is actually a defensive check, hence even if it fails, remove the volumes, hence its already removed.
        SRDFUtils.cleanupRDG(source, target, dbClient);
        completer.ready(dbClient);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) SRDFTaskCompleter(com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) NoSynchronizationsFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 SRDFTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFTaskCompleter)2 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)1 Volume (com.emc.storageos.db.client.model.Volume)1 LockRetryException (com.emc.storageos.locking.LockRetryException)1 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)1 NullTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.NullTaskCompleter)1 SRDFChangeCopyModeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFChangeCopyModeTaskCompleter)1 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)1 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)1 WorkflowException (com.emc.storageos.workflow.WorkflowException)1 WBEMException (javax.wbem.WBEMException)1