Search in sources :

Example 6 with AbstractSRDFOperationContextFactory

use of com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory 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

AbstractSRDFOperationContextFactory (com.emc.storageos.volumecontroller.impl.smis.srdf.AbstractSRDFOperationContextFactory)6 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)5 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)5 NoSynchronizationsFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.NoSynchronizationsFoundException)5 RemoteGroupAssociationNotFoundException (com.emc.storageos.volumecontroller.impl.smis.srdf.exceptions.RemoteGroupAssociationNotFoundException)5 WBEMException (javax.wbem.WBEMException)5 Volume (com.emc.storageos.db.client.model.Volume)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 URI (java.net.URI)3 LinkStatus (com.emc.storageos.db.client.model.Volume.LinkStatus)2 SRDFOperationContext (com.emc.storageos.volumecontroller.impl.smis.srdf.SRDFOperationContext)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 ArrayList (java.util.ArrayList)2 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 CustomQueryUtility.queryActiveResourcesByConstraint (com.emc.storageos.db.client.util.CustomQueryUtility.queryActiveResourcesByConstraint)1 SRDFChangeCopyModeTaskCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFChangeCopyModeTaskCompleter)1 SRDFLinkFailOverCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkFailOverCompleter)1 SRDFLinkStopCompleter (com.emc.storageos.volumecontroller.impl.block.taskcompleter.SRDFLinkStopCompleter)1