Search in sources :

Example 1 with SRDFOperation

use of com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation in project coprhd-controller by CoprHD.

the class SRDFOperations method performSuspend.

public void performSuspend(StorageSystem system, Volume target, boolean consExempt, boolean refreshVolumeProperties, TaskCompleter completer) {
    log.info("START performSuspend (consExempt={})", consExempt);
    checkTargetHasParentOrFail(target);
    ServiceError error = null;
    try {
        SRDFOperation op = consExempt ? SRDFOperation.SUSPEND_CONS_EXEMPT : SRDFOperation.SUSPEND;
        SRDFOperationContext suspendCtx = getContextFactory(system).build(op, target);
        suspendCtx.perform();
        if (refreshVolumeProperties) {
            refreshTargetVolumeProperties(system, target);
        }
    } catch (RemoteGroupAssociationNotFoundException e) {
        log.warn("No remote group association found for {}.  It may have already been removed.", target.getId());
    } catch (Exception e) {
        log.error("Failed to suspend srdf link {}", target.getSrdfParent().getURI(), e);
        error = SmisException.errors.jobFailed(e.getMessage());
    } finally {
        if (error == null) {
            completer.ready(dbClient);
        } else {
            completer.error(dbClient, error);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) SRDFOperation(com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation) SRDFOperationContext(com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext) 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)

Example 2 with SRDFOperation

use of com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation in project coprhd-controller by CoprHD.

the class SRDFOperations method performDetach.

public void performDetach(StorageSystem system, Volume target, boolean onGroup, TaskCompleter completer) {
    log.info("START performDetach");
    checkTargetHasParentOrFail(target);
    ServiceError error = null;
    try {
        AbstractSRDFOperationContextFactory ctxFactory = getContextFactory(system);
        SRDFOperation suspendOp = null;
        SRDFOperation detachOp = null;
        if (onGroup) {
            suspendOp = SRDFOperation.SUSPEND;
            detachOp = SRDFOperation.DELETE_GROUP_PAIRS;
        } else {
            if (target.getSrdfCopyMode() != null && target.getSrdfCopyMode().equals(Mode.ACTIVE.toString())) {
                suspendOp = SRDFOperation.SUSPEND;
            } else {
                suspendOp = SRDFOperation.SUSPEND_CONS_EXEMPT;
            }
            detachOp = SRDFOperation.DELETE_PAIR;
        }
        ctxFactory.build(suspendOp, target).perform();
        ctxFactory.build(detachOp, target).perform();
        utils.removeFromRemoteGroups(target);
    } catch (RemoteGroupAssociationNotFoundException e) {
        log.info("SRDF link is already detached {}", target.getSrdfParent().getURI(), e);
        // If SRDF link is already detached then we won't find the association hence we can just move on
        // to the next step.This is added because of SMIS intermittent issue where during delete volume
        // detach works but then after detach there is failure then retry never work if we don't catch
        // this exception. This is added to so that user can retry to delete volume.
        completer.ready(dbClient);
    } catch (Exception e) {
        log.error("Failed to detach srdf link {}", target.getSrdfParent().getURI(), e);
        error = SmisException.errors.jobFailed(e.getMessage());
    } finally {
        if (error == null) {
            completer.ready(dbClient);
        } else {
            completer.error(dbClient, error);
        }
    }
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) RemoteGroupAssociationNotFoundException(com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException) SRDFOperation(com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation) AbstractSRDFOperationContextFactory(com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory) 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)

Aggregations

DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)2 SRDFOperation (com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory.SRDFOperation)2 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)2 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)2 WBEMException (javax.wbem.WBEMException)2 AbstractSRDFOperationContextFactory (com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory)1 SRDFOperationContext (com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext)1