Search in sources :

Example 1 with IsilonSyncTargetPolicy

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);
    }
}
Also used : IsilonSyncTargetPolicy(com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy)

Example 2 with IsilonSyncTargetPolicy

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);
    }
}
Also used : IsilonSyncTargetPolicy(com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy) BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult)

Example 3 with IsilonSyncTargetPolicy

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;
    }
}
Also used : BiosCommandResult(com.emc.storageos.volumecontroller.impl.BiosCommandResult) IsilonSyncTargetPolicy(com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy)

Example 4 with IsilonSyncTargetPolicy

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);
    }
}
Also used : IsilonSyncTargetPolicy(com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy)

Example 5 with IsilonSyncTargetPolicy

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);
    }
}
Also used : IsilonSyncTargetPolicy(com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy) StringSet(com.emc.storageos.db.client.model.StringSet) ArrayList(java.util.ArrayList) URI(java.net.URI) FileShare(com.emc.storageos.db.client.model.FileShare) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Aggregations

IsilonSyncTargetPolicy (com.emc.storageos.isilon.restapi.IsilonSyncTargetPolicy)7 IsilonApi (com.emc.storageos.isilon.restapi.IsilonApi)3 IsilonException (com.emc.storageos.isilon.restapi.IsilonException)3 IsilonSyncPolicy (com.emc.storageos.isilon.restapi.IsilonSyncPolicy)2 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)2 URISyntaxException (java.net.URISyntaxException)2 FileShare (com.emc.storageos.db.client.model.FileShare)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 IsilonSyncJob (com.emc.storageos.isilon.restapi.IsilonSyncJob)1 JobState (com.emc.storageos.isilon.restapi.IsilonSyncPolicy.JobState)1 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)1 IsilonSyncJobFailover (com.emc.storageos.volumecontroller.impl.isilon.job.IsilonSyncJobFailover)1 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1