use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doExpandFS.
@Override
public BiosCommandResult doExpandFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
try {
_log.info("IsilonFileStorageDevice doExpandFS {} - start", args.getFsId());
IsilonApi isi = getIsilonDevice(storage);
String quotaId = null;
if (args.getFsExtensions() != null && args.getFsExtensions().get(QUOTA) != null) {
quotaId = args.getFsExtensions().get(QUOTA);
} else {
// when policy is applied at higher level, we will ignore the target filesystem
FileShare fileShare = args.getFs();
if (null != fileShare.getPersonality() && PersonalityTypes.TARGET.name().equals(fileShare.getPersonality()) && null == fileShare.getExtensions()) {
_log.info("Quota id is not found so ignore the expand filesystem ", fileShare.getLabel());
return BiosCommandResult.createSuccessfulResult();
}
final ServiceError serviceError = DeviceControllerErrors.isilon.doExpandFSFailed(args.getFsId());
_log.error(serviceError.getMessage());
return BiosCommandResult.createErrorResult(serviceError);
}
isiExpandFS(isi, quotaId, args);
_log.info("IsilonFileStorageDevice doExpandFS {} - complete", args.getFsId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doExpandFS failed.", e);
return BiosCommandResult.createErrorResult(e);
} catch (Exception e) {
_log.error("doExpandFS failed.", e);
// convert this to a ServiceError and create/or reuse a service
// code
ServiceError serviceError = DeviceControllerErrors.isilon.unableToExpandFileSystem();
return BiosCommandResult.createErrorResult(serviceError);
}
}
use of com.emc.storageos.isilon.restapi.IsilonApi 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.IsilonApi 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.IsilonApi 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;
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonSyncIQJob method getIsilonRestClient.
/**
* Get Isilon API client
*
* @param jobContext
* @return
*/
public IsilonApi getIsilonRestClient(JobContext jobContext) {
StorageSystem device = jobContext.getDbClient().queryObject(StorageSystem.class, _storageSystemUri);
if (jobContext.getIsilonApiFactory() != null) {
IsilonApi isilonAPI;
URI deviceURI;
try {
deviceURI = new URI("https", null, device.getIpAddress(), device.getPortNumber(), "/", null, null);
} catch (URISyntaxException ex) {
throw IsilonException.exceptions.errorCreatingServerURL(device.getIpAddress(), device.getPortNumber(), ex);
}
// get rest client
if (device.getUsername() != null && !device.getUsername().isEmpty()) {
isilonAPI = jobContext.getIsilonApiFactory().getRESTClient(deviceURI, device.getUsername(), device.getPassword());
} else {
isilonAPI = jobContext.getIsilonApiFactory().getRESTClient(deviceURI);
}
return isilonAPI;
}
return null;
}
Aggregations