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