use of com.emc.storageos.isilon.restapi.IsilonApi 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.IsilonApi 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.IsilonApi 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.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method getIsilonDevice.
/**
* Get isilon device represented by the StorageDevice
*
* @param device
* StorageDevice object
* @return IsilonApi object
* @throws IsilonException
*/
IsilonApi getIsilonDevice(StorageSystem device) throws IsilonException {
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);
}
if (device.getUsername() != null && !device.getUsername().isEmpty()) {
isilonAPI = _factory.getRESTClient(deviceURI, device.getUsername(), device.getPassword());
} else {
isilonAPI = _factory.getRESTClient(deviceURI);
}
return isilonAPI;
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonMirrorOperations method doTestReplicationPolicy.
/**
* Test Replication Connection and policy
*
* @param system
* @param policyName
* @return
*/
public BiosCommandResult doTestReplicationPolicy(StorageSystem system, String policyName) {
try {
IsilonApi isi = getIsilonDevice(system);
isi.getReplicationPolicy(policyName);
} catch (IsilonException ie) {
ServiceError error = DeviceControllerErrors.isilon.jobFailed("Unable to get the ReplicationPolicy details and message :" + ie.getMessage());
return BiosCommandResult.createErrorResult(error);
}
return BiosCommandResult.createSuccessfulResult();
}
Aggregations