use of com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doStartTargetMirrorPolicy.
/**
* start the mirror policy on target system
*
* @param sourceSystem - source system
* @param syncPolicyName - source policy name
* @param targetSystem - target system
* @param syncMirrorPolicyName - target mirror policy name
* @param completer
* @return
*/
private BiosCommandResult doStartTargetMirrorPolicy(StorageSystem sourceSystem, String policyName, StorageSystem targetSystem, String mirrorPolicyName, TaskCompleter completer) {
// get source policy details of local target on target system (policy : source -> target)
IsilonSyncTargetPolicy mirrorPolicy = mirrorOperations.getIsilonSyncTargetPolicy(sourceSystem, mirrorPolicyName);
// get target mirror policy details of local target on source system (*_mirror : target -> source)
IsilonSyncTargetPolicy policy = mirrorOperations.getIsilonSyncTargetPolicy(targetSystem, policyName);
_log.info("doStartTaregetMirrorPolicy - target policy details : {}", mirrorPolicy.toString());
// if already on target writes enable and perform start operation failback workflow
if (JobState.finished.equals(policy.getLastJobState()) && JobState.finished.equals(mirrorPolicy.getLastJobState()) && FOFB_STATES.writes_enabled.equals(mirrorPolicy.getFoFbState())) {
_log.info("Skipped the starting the mirror policy : {}", mirrorPolicyName);
_log.info(String.format("Source policy details : - %s and Target mirror policy details :- %s", policy.toString(), mirrorPolicy.toString()));
return BiosCommandResult.createSuccessfulResult();
} else if (JobState.failed.equals(mirrorPolicy.getLastJobState()) || JobState.needs_attention.equals(mirrorPolicy.getLastJobState())) {
return getSyncPolicyErrorReport(sourceSystem, mirrorPolicy);
} else if (JobState.failed.equals(policy.getLastJobState()) || JobState.needs_attention.equals(policy.getLastJobState())) {
return getSyncPolicyErrorReport(targetSystem, policy);
} else {
// call to isilon api
_log.info(String.format("Starting a mirror policy %s on target system %s ", policyName, targetSystem.getLabel()));
return mirrorOperations.doStartReplicationPolicy(targetSystem, mirrorPolicyName, completer);
}
}
use of com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doFailoverMirrorPolicy.
/**
* Failover on target mirror policy that enable write on source system.
* allow writes on source filesystem and on target system trasfer the controller to source system
* on write will be disable and next step resync-prep on target will sync source policy
*
* @param sourceSystem - source system
* @param policyName - source to target policy
* @param targetSystem - target system
* @param mirrorPolicyName - target to source mirror policy on failback operation
* @param completer
* @return
*/
private BiosCommandResult doFailoverMirrorPolicy(StorageSystem sourceSystem, String policyName, StorageSystem targetSystem, String mirrorPolicyName, TaskCompleter completer) {
IsilonSyncTargetPolicy policy = null;
IsilonSyncTargetPolicy mirrorPolicy = null;
// if policy enables on target storage then We should disable it before failback job
BiosCommandResult result = mirrorOperations.doStopReplicationPolicy(targetSystem, mirrorPolicyName);
if (!result.isCommandSuccess()) {
return result;
}
// get source policy details of local target on target system (policy : source -> target)
mirrorPolicy = mirrorOperations.getIsilonSyncTargetPolicy(sourceSystem, mirrorPolicyName);
// get target mirror policy details of local target on source system (policy : target -> source)
policy = mirrorOperations.getIsilonSyncTargetPolicy(targetSystem, policyName);
// always source policy should be in 'resync_policy_create' state
if (JobState.finished.equals(policy.getLastJobState()) && FOFB_STATES.resync_policy_created.equals(policy.getFoFbState()) && JobState.finished.equals(mirrorPolicy.getLastJobState()) && FOFB_STATES.writes_enabled.equals(mirrorPolicy.getFoFbState())) {
_log.info("Skipped the failover action on mirror policy : {}", mirrorPolicyName);
_log.info(String.format("Source policy details : - %s and Target policy details :- %s", policy.toString(), mirrorPolicy.toString()));
return BiosCommandResult.createSuccessfulResult();
// if policy is in error state then call to get error reports from device.
} else if (JobState.failed.equals(mirrorPolicy.getLastJobState()) || JobState.needs_attention.equals(mirrorPolicy.getLastJobState())) {
return getSyncPolicyErrorReport(sourceSystem, mirrorPolicy);
// get source policy error reports
} else if (JobState.failed.equals(policy.getLastJobState()) || JobState.needs_attention.equals(policy.getLastJobState())) {
return getSyncPolicyErrorReport(targetSystem, policy);
} else {
// on failover of target mirror policy, the target local policy will be "writes enabled"
return mirrorOperations.doFailover(sourceSystem, mirrorPolicyName, completer);
}
}
use of com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doResyncPrepSourcePolicy.
/**
* this command issue on source system when source policy in failover state.
* when resync-prep issue on source policy then it will create mirror policy.
* this mirror policy will from source to target
*
* 'resync-prep' call on source policy will create new "*_mirror" policy
*
* @param sourceSystem - source system
* @param targetSystem - target system
* @param sourcePolicyName - source policy name from source to target
* @param completer
* @return
*/
private BiosCommandResult doResyncPrepSourcePolicy(StorageSystem sourceSystem, StorageSystem targetSystem, String policyName, TaskCompleter completer) {
_log.info("doResyncPrepSourcePolicy - resync-prep action on source policy {} ", policyName);
BiosCommandResult cmdResult = null;
IsilonSyncTargetPolicy policy = null;
// test the source policy details
cmdResult = mirrorOperations.doTestReplicationPolicy(sourceSystem, policyName);
if (cmdResult.isCommandSuccess()) {
// get source policy details on target storage system
policy = mirrorOperations.getIsilonSyncTargetPolicy(targetSystem, policyName);
if (cmdResult.isCommandSuccess() && null != policy) {
// enable the replication policy
cmdResult = mirrorOperations.doEnablePolicy(sourceSystem, policyName);
if (!cmdResult.isCommandSuccess()) {
return cmdResult;
}
// get source policy details of local target on target system (policy : source -> target)
if (JobState.finished.equals(policy.getLastJobState()) && FOFB_STATES.resync_policy_created.equals(policy.getFoFbState())) {
_log.info("Skipped the resyncprep action on policy : {}", policyName);
_log.info(String.format("Source policy details : - %s ", policy.toString()));
return BiosCommandResult.createSuccessfulResult();
// if policy is failed then we call to get the reports, return error
} else if (JobState.failed.equals(policy.getLastJobState()) || JobState.needs_attention.equals(policy.getLastJobState())) {
return getSyncPolicyErrorReport(sourceSystem, policy);
} else {
// call isilon api
return mirrorOperations.doResyncPrep(sourceSystem, policyName, completer);
}
} else {
return cmdResult;
}
} else {
return cmdResult;
}
}
use of com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doResyncPrepTargetPolicy.
/**
* 'resync-prep' call on mirror policy of target system that enable source policy.
* the target will be writes_disable and source will allow the writes.
* * this operation activate source policy and source policy allow the write operations.
*
* @param targetSystem - target system
* @param mirrorPolicy - mirror policy name from target to source.
* @param sourceSystem - source system
* @param sourcePolicyName - source policy name from source to target
* @param completer
* @return
*/
private BiosCommandResult doResyncPrepTargetPolicy(StorageSystem sourceSystem, String policyName, StorageSystem targetSystem, String mirrorPolicyName, TaskCompleter completer) {
_log.info("doResyncPrepTargetPolicy - resync-prep action on mirror policy ", mirrorPolicyName);
IsilonSyncTargetPolicy policy = null;
IsilonSyncTargetPolicy mirrorPolicy = null;
// get mirror policy of local targets on source system (mirror_policy: target-> source )
mirrorPolicy = mirrorOperations.getIsilonSyncTargetPolicy(sourceSystem, mirrorPolicyName);
// get source policy details of local target on target system (policy : source -> target)
policy = mirrorOperations.getIsilonSyncTargetPolicy(targetSystem, policyName);
// if mirror has already in "resync-policy-created" and source policy is "write_disabled"
if (JobState.finished.equals(mirrorPolicy.getLastJobState()) && FOFB_STATES.resync_policy_created.equals(mirrorPolicy.getFoFbState()) && JobState.finished.equals(policy.getLastJobState()) && FOFB_STATES.writes_disabled.equals(policy.getFoFbState())) {
_log.info("Skipped the resyncprep action on mirror policy : {}", mirrorPolicyName);
_log.info(String.format("Source policy details : - %s and Target policy details :- %s", policy.toString(), mirrorPolicy.toString()));
return BiosCommandResult.createSuccessfulResult();
// if policy is in error state then call to get error reports from device.
} else if (JobState.failed.equals(mirrorPolicy.getLastJobState()) || JobState.needs_attention.equals(mirrorPolicy.getLastJobState())) {
return getSyncPolicyErrorReport(sourceSystem, mirrorPolicy);
// get the source policy error report
} else if (JobState.failed.equals(policy.getLastJobState()) || JobState.needs_attention.equals(policy.getLastJobState())) {
return getSyncPolicyErrorReport(targetSystem, policy);
} else {
// call isilon api
return mirrorOperations.doResyncPrep(targetSystem, mirrorPolicyName, completer);
}
}
use of com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method doRefreshMirrorFileShareLink.
public BiosCommandResult doRefreshMirrorFileShareLink(StorageSystem system, FileShare source, String policyName) throws DeviceControllerException {
IsilonSyncPolicy policy;
IsilonSyncTargetPolicy localTarget = null;
StringSet targets = source.getMirrorfsTargets();
List<URI> targetFSURI = new ArrayList<>();
for (String target : targets) {
targetFSURI.add(URI.create(target));
}
FileShare target = _dbClient.queryObject(FileShare.class, targetFSURI.get(0));
StorageSystem systemTarget = _dbClient.queryObject(StorageSystem.class, target.getStorageDevice());
try {
IsilonApi isiPrimary = getIsilonDevice(system);
IsilonApi isiSecondary = getIsilonDevice(systemTarget);
policy = isiPrimary.getReplicationPolicy(policyName);
if (policy.getLastStarted() != null) {
localTarget = isiSecondary.getTargetReplicationPolicy(policyName);
}
if (policy.getLastStarted() == null) {
source.setMirrorStatus(MirrorStatus.UNKNOWN.toString());
} else if (!policy.getEnabled() || policy.getLastJobState().equals(JobState.paused)) {
source.setMirrorStatus(MirrorStatus.PAUSED.toString());
} else if (localTarget.getFoFbState().equals(FOFB_STATES.writes_enabled)) {
source.setMirrorStatus(MirrorStatus.FAILED_OVER.toString());
} else if (policy.getEnabled() && policy.getLastJobState().equals(JobState.finished) && localTarget.getFoFbState().equals(FOFB_STATES.writes_disabled)) {
source.setMirrorStatus(MirrorStatus.SYNCHRONIZED.toString());
} else if (policy.getLastJobState().equals(JobState.running)) {
source.setMirrorStatus(MirrorStatus.IN_SYNC.toString());
} else if (policy.getLastJobState().equals(JobState.failed) || policy.getLastJobState().equals(JobState.needs_attention)) {
source.setMirrorStatus(MirrorStatus.ERROR.toString());
}
_dbClient.updateObject(source);
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("refresh mirror satus failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
Aggregations