use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doSnapshotFS.
@Override
public BiosCommandResult doSnapshotFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
try {
_log.info("IsilonFileStorageDevice doSnapshotFS {} {} - start", args.getSnapshotId(), args.getSnapshotName());
IsilonApi isi = getIsilonDevice(storage);
// To Do - add timestamp for uniqueness
String snapId = isi.createSnapshot(args.getSnapshotName(), args.getFsMountPath());
if (args.getSnapshotExtensions() == null) {
args.initSnapshotExtensions();
}
args.getSnapshotExtensions().put("id", snapId);
args.setSnapNativeId(snapId);
String path = getSnapshotPath(args.getFsMountPath(), args.getSnapshotName());
args.setSnapshotMountPath(path);
args.setSnapshotPath(path);
_log.info("IsilonFileStorageDevice doSnapshotFS {} - complete", args.getSnapshotId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doSnapshotFS failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doDeleteSnapshot.
@Override
public BiosCommandResult doDeleteSnapshot(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
try {
_log.info("IsilonFileStorageDevice doDeleteSnapshot {} - start", args.getSnapshotId());
IsilonApi isi = getIsilonDevice(storage);
isiDeleteSnapshot(isi, args);
_log.info("IsilonFileStorageDevice doDeleteSnapshot {} - complete", args.getSnapshotId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doDeleteSnapshot failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doCheckFSDependencies.
@Override
public BiosCommandResult doCheckFSDependencies(StorageSystem storage, FileDeviceInputOutput args) {
_log.info("Checking file system {} has dependencies in storage array: {}", args.getFsName(), storage.getLabel());
boolean hasDependency = true;
String vnasName = null;
VirtualNAS vNas = args.getvNAS();
if (vNas != null) {
vnasName = vNas.getNasName();
}
try {
String fsMountPath = args.getFsMountPath();
hasDependency = doesNFSExportExistsForFSPath(storage, vnasName, fsMountPath);
if (!hasDependency) {
hasDependency = doesCIFSShareExistsForFSPath(storage, vnasName, fsMountPath);
}
if (!hasDependency) {
hasDependency = doesSnapshotExistsForFSPath(storage, vnasName, fsMountPath);
}
if (hasDependency) {
_log.error("File system has dependencies on array: {}", args.getFsName());
DeviceControllerException e = DeviceControllerException.exceptions.fileSystemHasDependencies(fsMountPath);
return BiosCommandResult.createErrorResult(e);
}
_log.info("File system has no dependencies on array: {}", args.getFsName());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("Checking FS dependencies failed.", e);
throw e;
}
}
use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method updateNfsACLs.
@Override
public BiosCommandResult updateNfsACLs(StorageSystem storage, FileDeviceInputOutput args) {
try {
// read nameToSid flag from controller config.
Boolean sidEnable = customConfigHandler.getComputedCustomConfigBooleanValue(CustomConfigConstants.ISILON_USER_TO_SID_MAPPING_FOR_NFS_ENABLED, storage.getSystemType(), null);
// get sid mapping based on Controller config and it belong to VirtualNAS.
if (sidEnable && args.getvNAS() != null) {
updateSidInfoForNfsACE(args, storage);
}
IsilonNFSACL isilonAcl = new IsilonNFSACL();
ArrayList<Acl> aclCompleteList = new ArrayList<Acl>();
List<NfsACE> aceToAdd = args.getNfsAclsToAdd();
for (NfsACE nfsACE : aceToAdd) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("add");
aclCompleteList.add(acl);
}
List<NfsACE> aceToModify = args.getNfsAclsToModify();
for (NfsACE nfsACE : aceToModify) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("replace");
aclCompleteList.add(acl);
}
List<NfsACE> aceToDelete = args.getNfsAclsToDelete();
for (NfsACE nfsACE : aceToDelete) {
Acl acl = getIsilonAclFromNfsACE(nfsACE);
acl.setOp("delete");
aclCompleteList.add(acl);
}
isilonAcl.setAction("update");
isilonAcl.setAuthoritative("acl");
isilonAcl.setAcl(aclCompleteList);
String path = args.getFileSystemPath();
if (args.getSubDirectory() != null && !args.getSubDirectory().isEmpty()) {
path = path + "/" + args.getSubDirectory();
}
// Process new ACLs
IsilonApi isi = getIsilonDevice(storage);
_log.info("Calling Isilon API: modify NFS Acl for {}, acl {}", args.getFileSystemPath(), isilonAcl);
isi.modifyNFSACL(path, isilonAcl);
_log.info("End updateNfsACLs");
BiosCommandResult result = BiosCommandResult.createSuccessfulResult();
return result;
} catch (IsilonException e) {
_log.error("updateNfsACLs failed ", e);
return BiosCommandResult.createErrorResult(e);
} catch (Exception e) {
_log.error("updateNfsACLs failed ", e);
final ServiceCoded serviceCoded = DeviceControllerException.errors.jobFailedOpMsg(OperationTypeEnum.UPDATE_FILE_SYSTEM_NFS_ACL.toString(), e.getMessage());
return BiosCommandResult.createErrorResult(serviceCoded);
}
}
use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method doStopReplicationPolicy.
/**
* Call to device to stop policy
*
* @param system
* @param policyName
* @return
*/
public BiosCommandResult doStopReplicationPolicy(IsilonApi isi, String policyName) {
try {
IsilonSyncPolicy policy = isi.getReplicationPolicy(policyName);
if (policy.getLastJobState().equals(JobState.running)) {
BiosCommandResult cmdResult = doCancelReplicationPolicy(isi, policyName);
if (!cmdResult.isCommandSuccess()) {
return cmdResult;
} else {
// if the replication still running through exception
policy = isi.getReplicationPolicy(policyName);
if (policy.getLastJobState().equals(JobState.running)) {
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Unable Stop Replication policy and policy state :" + policy.getLastJobState().toString());
return BiosCommandResult.createErrorResult(error);
}
}
}
// disable the policy
if (policy.getEnabled()) {
IsilonSyncPolicy modifiedPolicy = new IsilonSyncPolicy();
modifiedPolicy.setEnabled(false);
isi.modifyReplicationPolicy(policyName, modifiedPolicy);
_log.info("Sleeping for 40 seconds for stop operation to complete...");
TimeUnit.SECONDS.sleep(40);
_log.info("Replication Policy -{} disabled successfully.", policy.toString());
return BiosCommandResult.createSuccessfulResult();
} else {
_log.info("Replication Policy - {} can't be STOPPED because policy is already DISABLED", policy.toString());
return BiosCommandResult.createSuccessfulResult();
}
} catch (IsilonException e) {
return BiosCommandResult.createErrorResult(e);
} catch (InterruptedException ex) {
_log.warn("Stoping ReplicationPolicy - {} Interrupted", policyName);
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Stoping ReplicationPolicy is Failed with Interrupt exception and message :" + ex.getMessage());
return BiosCommandResult.createErrorResult(error);
}
}
Aggregations