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);
}
}
}
Aggregations