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