Search in sources :

Example 21 with IsilonSyncPolicy

use of com.emc.storageos.isilon.restapi.IsilonSyncPolicy in project coprhd-controller by CoprHD.

the class IsilonFileStorageDevice method doPauseLink.

@Override
public BiosCommandResult doPauseLink(StorageSystem system, FileShare source) {
    IsilonSyncPolicy syncpolicy = null;
    PolicyStorageResource policyStrRes = getEquivalentPolicyStorageResource(source, _dbClient);
    if (policyStrRes != null) {
        syncpolicy = policyNativeIdValidation(system, policyStrRes);
        String policyId = syncpolicy.getId();
        JobState policyState = syncpolicy.getLastJobState();
        if (policyState.equals(JobState.running) || policyState.equals(JobState.paused)) {
            mirrorOperations.doCancelReplicationPolicy(system, policyId);
        }
        return mirrorOperations.doStopReplicationPolicy(system, policyId);
    }
    ServiceError serviceError = DeviceControllerErrors.isilon.unableToCreateFileShare();
    return BiosCommandResult.createErrorResult(serviceError);
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) JobState(com.emc.storageos.isilon.restapi.IsilonSyncPolicy.JobState) PolicyStorageResource(com.emc.storageos.db.client.model.PolicyStorageResource) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy)

Example 22 with IsilonSyncPolicy

use of com.emc.storageos.isilon.restapi.IsilonSyncPolicy in project coprhd-controller by CoprHD.

the class IsilonFileStorageDevice method doResyncLink.

@Override
public BiosCommandResult doResyncLink(StorageSystem system, FileShare fs, TaskCompleter completer) {
    FileShare sourceFS = null;
    FileShare targetFS = null;
    StorageSystem targetSystem = null;
    StorageSystem sourceSystem = null;
    boolean isMirrorPolicy = false;
    if (fs.getPersonality().equals(PersonalityTypes.TARGET.name())) {
        sourceFS = _dbClient.queryObject(FileShare.class, fs.getParentFileShare());
        targetFS = fs;
        isMirrorPolicy = true;
    } else if (fs.getPersonality().equals(PersonalityTypes.SOURCE.name())) {
        sourceFS = fs;
        if (null != fs.getMirrorfsTargets() && !fs.getMirrorfsTargets().isEmpty()) {
            List<String> targetfileUris = new ArrayList<String>();
            targetfileUris.addAll(fs.getMirrorfsTargets());
            targetFS = _dbClient.queryObject(FileShare.class, URI.create(targetfileUris.get(0)));
        } else {
            ServiceError serviceError = DeviceControllerErrors.isilon.unableToGetTargetFileSystem(sourceFS.getLabel());
            return BiosCommandResult.createErrorResult(serviceError);
        }
    }
    targetSystem = _dbClient.queryObject(StorageSystem.class, targetFS.getStorageDevice());
    sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceFS.getStorageDevice());
    PolicyStorageResource policyStrRes = getEquivalentPolicyStorageResource(sourceFS, _dbClient);
    if (policyStrRes != null) {
        IsilonSyncPolicy syncTargetPolicy = policyNativeIdValidation(sourceSystem, policyStrRes);
        // In case of failback step 4 we do resysc on the target file system, so we need to append _mirror
        if (isMirrorPolicy) {
            String mirrorPolicyName = syncTargetPolicy.getName();
            mirrorPolicyName = mirrorPolicyName.concat(MIRROR_POLICY);
            // 'resync-prep' on target mirror policy
            return doResyncPrepTargetPolicy(sourceSystem, syncTargetPolicy.getName(), targetSystem, mirrorPolicyName, completer);
        } else {
            // 'resync-prep' operation on source storagesystem
            return doResyncPrepSourcePolicy(sourceSystem, targetSystem, syncTargetPolicy.getId(), completer);
        }
    }
    ServiceError serviceError = DeviceControllerErrors.isilon.unableToGetPolicy(system.getLabel(), "Unable to get policy details");
    return BiosCommandResult.createErrorResult(serviceError);
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) IsilonList(com.emc.storageos.isilon.restapi.IsilonApi.IsilonList) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) PolicyStorageResource(com.emc.storageos.db.client.model.PolicyStorageResource) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 23 with IsilonSyncPolicy

use of com.emc.storageos.isilon.restapi.IsilonSyncPolicy in project coprhd-controller by CoprHD.

the class IsilonMirrorOperations method doEnablePolicy.

/**
 * Enable the Isilon syncIQ policy
 *
 * @param system - storagesystem
 * @param policyName
 * @return
 */
BiosCommandResult doEnablePolicy(StorageSystem system, String policyName) {
    IsilonApi isi = getIsilonDevice(system);
    IsilonSyncPolicy policy = isi.getReplicationPolicy(policyName);
    if (null != policy && !policy.getEnabled()) {
        IsilonSyncPolicy modifiedPolicy = new IsilonSyncPolicy();
        modifiedPolicy.setEnabled(true);
        try {
            isi.modifyReplicationPolicy(policyName, modifiedPolicy);
            TimeUnit.SECONDS.sleep(33);
        } catch (InterruptedException e) {
            _log.warn("Enabling ReplicationPolicy - {} Interrupted", policyName);
            ServiceError error = DeviceControllerErrors.isilon.jobFailed("Enabling ReplicationPolicy is Failed with Interrupt exception and message :" + e.getMessage());
            return BiosCommandResult.createErrorResult(error);
        } catch (IsilonException ex) {
            return BiosCommandResult.createErrorResult(ex);
        }
    }
    return BiosCommandResult.createSuccessfulResult();
}
Also used : ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 24 with IsilonSyncPolicy

use of com.emc.storageos.isilon.restapi.IsilonSyncPolicy in project coprhd-controller by CoprHD.

the class IsilonMirrorOperations method dodeleteReplicationPolicy.

/**
 * Call to device to delete the policy
 *
 * @param system
 * @param policyName
 * @return
 */
public BiosCommandResult dodeleteReplicationPolicy(StorageSystem system, String policyName) {
    try {
        IsilonApi isi = getIsilonDevice(system);
        IsilonSyncPolicy policy = isi.getReplicationPolicy(policyName);
        JobState policyState = policy.getLastJobState();
        if (policyState.equals(JobState.running) || policyState.equals(JobState.paused)) {
            _log.info("Canceling Replication Policy  -{} because policy is in - {} state ", policyName, policyState);
            IsilonSyncPolicy modifiedPolicy = new IsilonSyncPolicy();
            modifiedPolicy.setName(policyName);
            modifiedPolicy.setLastJobState(JobState.canceled);
            isi.modifyReplicationPolicy(policyName, modifiedPolicy);
        }
        isi.deleteReplicationPolicy(policyName);
        _log.info("dodeleteReplicationPolicy - {} finished succesfully", policy.toString());
        _log.info("Sleeping for 10 seconds for detach mirror to complete...");
        TimeUnit.SECONDS.sleep(10);
        return BiosCommandResult.createSuccessfulResult();
    } catch (IsilonException e) {
        return BiosCommandResult.createErrorResult(e);
    } catch (InterruptedException e) {
        _log.warn("dodeleteReplicationPolicy - {} Interrupted");
        return BiosCommandResult.createSuccessfulResult();
    }
}
Also used : JobState(com.emc.storageos.isilon.restapi.IsilonSyncPolicy.JobState) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Example 25 with IsilonSyncPolicy

use of com.emc.storageos.isilon.restapi.IsilonSyncPolicy in project coprhd-controller by CoprHD.

the class IsilonSyncIQJob method poll.

@Override
public JobPollResult poll(JobContext jobContext, long trackingPeriodInMillis) {
    String currentJob = _jobIds.get(0);
    try {
        IsilonApi isiApiClient = getIsilonRestClient(jobContext);
        if (isiApiClient == null) {
            String errorMessage = "No Isilon REST API client found for: " + _storageSystemUri;
            processTransientError(currentJob, trackingPeriodInMillis, errorMessage, null);
        } else {
            _pollResult.setJobName(_jobName);
            _pollResult.setJobId(_taskCompleter.getOpId());
            IsilonSyncPolicy policy = isiApiClient.getReplicationPolicy(currentJob);
            IsilonSyncPolicy.JobState policyState = policy.getLastJobState();
            if (policyState.equals(JobState.running)) {
                _status = JobStatus.IN_PROGRESS;
            } else if (policyState.equals(JobState.finished)) {
                _status = JobStatus.SUCCESS;
                _pollResult.setJobPercentComplete(100);
                _logger.info("IsilonSyncIQJob: {} succeeded", currentJob);
            } else {
                _errorDescription = isiGetReportErrMsg(isiApiClient.getReplicationPolicyReports(currentJob).getList());
                _pollResult.setJobPercentComplete(100);
                _pollResult.setErrorDescription(_errorDescription);
                _status = JobStatus.FAILED;
                _logger.error("IsilonSyncIQJob: {} failed; Details: {}", currentJob, _errorDescription);
            }
        }
    } catch (Exception e) {
        processTransientError(currentJob, trackingPeriodInMillis, e.getMessage(), e);
    } finally {
        try {
            updateStatus(jobContext);
        } catch (Exception e) {
            setErrorStatus(e.getMessage());
            _logger.error("Problem while trying to update status", e);
        }
    }
    _pollResult.setJobStatus(_status);
    return _pollResult;
}
Also used : JobState(com.emc.storageos.isilon.restapi.IsilonSyncPolicy.JobState) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) IsilonSyncPolicy(com.emc.storageos.isilon.restapi.IsilonSyncPolicy) URISyntaxException(java.net.URISyntaxException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Aggregations

IsilonSyncPolicy (com.emc.storageos.isilon.restapi.IsilonSyncPolicy)25 IsilonApi (com.emc.storageos.isilon.restapi.IsilonApi)13 IsilonException (com.emc.storageos.isilon.restapi.IsilonException)13 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)12 PolicyStorageResource (com.emc.storageos.db.client.model.PolicyStorageResource)8 JobState (com.emc.storageos.isilon.restapi.IsilonSyncPolicy.JobState)7 FileShare (com.emc.storageos.db.client.model.FileShare)6 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)6 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)5 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)4 ArrayList (java.util.ArrayList)4 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)3 IsilonList (com.emc.storageos.isilon.restapi.IsilonApi.IsilonList)3 IsilonSyncPolicy8Above (com.emc.storageos.isilon.restapi.IsilonSyncPolicy8Above)3 URISyntaxException (java.net.URISyntaxException)3 List (java.util.List)3 FilePolicy (com.emc.storageos.db.client.model.FilePolicy)2 VirtualNAS (com.emc.storageos.db.client.model.VirtualNAS)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 IsilonSyncJob (com.emc.storageos.isilon.restapi.IsilonSyncJob)2