use of com.emc.storageos.volumecontroller.impl.isilon.job.IsilonSyncJobStart in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method doStartReplicationPolicy.
/**
* Call to isilon to start replication session
*
* @param system
* @param policyName
* @return
*/
public BiosCommandResult doStartReplicationPolicy(StorageSystem system, String policyName, TaskCompleter taskCompleter) {
_log.info("IsilonMirrorOperations - doStartReplicationPolicy started on storagesystem {}", system.getLabel());
try {
IsilonApi isi = getIsilonDevice(system);
IsilonSyncPolicy policy = isi.getReplicationPolicy(policyName);
IsilonSyncPolicy.JobState policyState = policy.getLastJobState();
if (!policy.getEnabled()) {
policy = doEnableReplicationPolicy(isi, policyName);
if (policy.getEnabled()) {
_log.info("Replication Policy - {} ENABLED successfully", policy.toString());
}
}
if (!policyState.equals(JobState.running) || !policyState.equals(JobState.paused) || !policyState.equals(JobState.resumed)) {
IsilonSyncJob job = new IsilonSyncJob();
job.setId(policyName);
isi.modifyReplicationJob(job);
policy = isi.getReplicationPolicy(policyName);
IsilonSyncJobStart isiSyncJobStart = new IsilonSyncJobStart(policyName, system.getId(), taskCompleter, policyName);
try {
ControllerServiceImpl.enqueueJob(new QueueJob(isiSyncJobStart));
return BiosCommandResult.createPendingResult();
} catch (Exception ex) {
_log.error("Start Replication Job Failed ", ex);
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Start Replication Job Failed as:" + ex.getMessage());
if (taskCompleter != null) {
taskCompleter.error(_dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
} else {
_log.error("Replication Policy - {} can't be STARTED because policy is in {} state", policyName, policyState);
ServiceError error = DeviceControllerErrors.isilon.jobFailed("doStartReplicationPolicy as : Replication Policy can't be STARTED because " + "policy is already in Active state");
return BiosCommandResult.createErrorResult(error);
}
} catch (IsilonException e) {
_log.error("doStartReplicationPolicy failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
Aggregations