use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doModifyFS.
@Override
public BiosCommandResult doModifyFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
try {
_log.info("IsilonFileStorageDevice doModifyFS {} - 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 {
final ServiceError serviceError = DeviceControllerErrors.isilon.unableToUpdateFileSystem(args.getFsId());
_log.error(serviceError.getMessage());
return BiosCommandResult.createErrorResult(serviceError);
}
IsilonSmartQuota expandedQuota = getExpandedQuota(isi, args, args.getFsCapacity());
isi.modifyQuota(quotaId, expandedQuota);
_log.info("IsilonFileStorageDevice doModifyFS {} - complete", args.getFsId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doModifyFS failed.", e);
return BiosCommandResult.createErrorResult(e);
} catch (Exception e) {
_log.error("doModifyFS failed.", e);
// convert this to a ServiceError and create/or reuse a service
// code
ServiceError serviceError = DeviceControllerErrors.isilon.unableToUpdateFileSystem(args.getFsId());
return BiosCommandResult.createErrorResult(serviceError);
}
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method extraExportRuleFromArray.
/**
* Get the export rule which are present in arry but not in CoprHD Database.
*
* @param storage
* @param args
* @return map with security flavor and export rule
*/
private Map<String, ExportRule> extraExportRuleFromArray(StorageSystem storage, FileDeviceInputOutput args) {
// map to store the export rule grouped by sec flavor
Map<String, ExportRule> exportRuleMap = new HashMap<>();
List<IsilonExport> exportsList = new ArrayList<IsilonExport>();
Set<String> arrayReadOnlyHost = new HashSet<>();
Set<String> arrayReadWriteHost = new HashSet<>();
Set<String> arrayRootHost = new HashSet<>();
Set<String> dbReadOnlyHost = new HashSet<>();
Set<String> dbReadWriteHost = new HashSet<>();
Set<String> dbRootHost = new HashSet<>();
// get all export rule from CoprHD data base
List<ExportRule> existingDBExportRules = args.getExistingDBExportRules();
// get the all the export from the storage system.
IsilonApi isi = getIsilonDevice(storage);
for (ExportRule exportRule : existingDBExportRules) {
if (exportRule.getReadOnlyHosts() != null) {
dbReadOnlyHost.addAll(exportRule.getReadOnlyHosts());
}
if (exportRule.getReadWriteHosts() != null) {
dbReadWriteHost.addAll(exportRule.getReadWriteHosts());
}
if (exportRule.getRootHosts() != null) {
dbRootHost.addAll(exportRule.getRootHosts());
}
String isilonExportId = exportRule.getDeviceExportId();
if (isilonExportId != null) {
IsilonExport isilonExport = null;
String zoneName = getZoneName(args.getvNAS());
if (zoneName != null) {
isilonExport = isi.getExport(isilonExportId, zoneName);
} else {
isilonExport = isi.getExport(isilonExportId);
}
exportsList.add(isilonExport);
arrayReadOnlyHost.addAll(isilonExport.getReadOnlyClients());
arrayReadWriteHost.addAll(isilonExport.getReadWriteClients());
arrayRootHost.addAll(isilonExport.getRootClients());
}
// find out the change between array and CoprHD database.
Set<String> arrayExtraReadOnlyHost = Sets.difference(arrayReadOnlyHost, dbReadOnlyHost);
Set<String> arrayExtraReadWriteHost = Sets.difference(arrayReadWriteHost, dbReadWriteHost);
Set<String> arrayExtraRootHost = Sets.difference(arrayRootHost, dbRootHost);
// if change found update the exportRuleMap
if (!arrayExtraReadOnlyHost.isEmpty() || !arrayExtraReadWriteHost.isEmpty() || !arrayExtraRootHost.isEmpty()) {
ExportRule extraRuleFromArray = new ExportRule();
extraRuleFromArray.setDeviceExportId(exportRule.getDeviceExportId());
extraRuleFromArray.setAnon(exportRule.getAnon());
extraRuleFromArray.setSecFlavor(exportRule.getSecFlavor());
extraRuleFromArray.setExportPath(exportRule.getExportPath());
extraRuleFromArray.setReadOnlyHosts(arrayExtraReadOnlyHost);
extraRuleFromArray.setReadWriteHosts(arrayExtraReadWriteHost);
extraRuleFromArray.setRootHosts(arrayExtraRootHost);
exportRuleMap.put(exportRule.getSecFlavor(), extraRuleFromArray);
}
}
return exportRuleMap;
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doConnect.
@Override
public void doConnect(StorageSystem storage) throws ControllerException {
try {
_log.info("doConnect {} - start", storage.getId());
IsilonApi isi = getIsilonDevice(storage);
isi.getClusterInfo();
String msg = String.format("doConnect %1$s - complete", storage.getId());
_log.info(msg);
} catch (IsilonException e) {
_log.error("doConnect failed.", e);
throw DeviceControllerException.exceptions.connectStorageFailed(e);
}
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method deleteNfsACLs.
@Override
public BiosCommandResult deleteNfsACLs(StorageSystem storage, FileDeviceInputOutput args) {
IsilonNFSACL isilonAcl = new IsilonNFSACL();
ArrayList<Acl> aclCompleteList = new ArrayList<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: to delete NFS Acl for {}, acl {}", args.getFileSystemPath(), isilonAcl);
isi.modifyNFSACL(path, isilonAcl);
_log.info("End deleteNfsACLs");
BiosCommandResult result = BiosCommandResult.createSuccessfulResult();
return result;
}
use of com.emc.storageos.isilon.restapi.IsilonApi in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doUnexport.
@Override
public BiosCommandResult doUnexport(StorageSystem storage, FileDeviceInputOutput args, List<FileExport> exportList) throws ControllerException {
try {
_log.info("IsilonFileStorageDevice doUnexport: {} - start", args.getFileObjId());
IsilonApi isi = getIsilonDevice(storage);
isiUnexport(isi, args, exportList);
_log.info("IsilonFileStorageDevice doUnexport {} - complete", args.getFileObjId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doUnexport failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
Aggregations