use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method listSanpshotByPolicy.
@Override
public BiosCommandResult listSanpshotByPolicy(StorageSystem storageObj, FileDeviceInputOutput args) {
FilePolicy sp = args.getFileProtectionPolicy();
FileShare fs = args.getFs();
String snapshotScheduleName = sp.getFilePolicyName() + "_" + args.getFsName();
if (sp.getPolicyStorageResources() != null && !sp.getPolicyStorageResources().isEmpty()) {
for (String uriResource : sp.getPolicyStorageResources()) {
PolicyStorageResource policyRes = _dbClient.queryObject(PolicyStorageResource.class, URI.create(uriResource));
if (policyRes != null && policyRes.getStorageSystem().equals(storageObj.getId())) {
snapshotScheduleName = policyRes.getPolicyNativeId();
break;
}
}
}
IsilonApi isi = getIsilonDevice(storageObj);
String resumeToken = null;
try {
do {
IsilonList<IsilonSnapshot> snapshots = isi.listSnapshotsCreatedByPolicy(resumeToken, snapshotScheduleName);
if (snapshots != null) {
for (IsilonSnapshot islon_snap : snapshots.getList()) {
_log.info("file policy snapshot is : " + islon_snap.getName());
Snapshot snap = new Snapshot();
snap.setLabel(islon_snap.getName());
snap.setMountPath(islon_snap.getPath());
snap.setName(islon_snap.getName());
snap.setId(URIUtil.createId(Snapshot.class));
snap.setOpStatus(new OpStatusMap());
snap.setProject(new NamedURI(fs.getProject().getURI(), islon_snap.getName()));
snap.setMountPath(getSnapshotPath(islon_snap.getPath(), islon_snap.getName()));
snap.setParent(new NamedURI(fs.getId(), islon_snap.getName()));
StringMap map = new StringMap();
Long createdTime = Long.parseLong(islon_snap.getCreated()) * SEC_IN_MILLI;
String expiresTime = "Never";
if (islon_snap.getExpires() != null && !islon_snap.getExpires().isEmpty()) {
Long expTime = Long.parseLong(islon_snap.getExpires()) * SEC_IN_MILLI;
expiresTime = expTime.toString();
}
map.put("created", createdTime.toString());
map.put("expires", expiresTime);
map.put("schedule", sp.getFilePolicyName());
snap.setExtensions(map);
_dbClient.updateObject(snap);
}
resumeToken = snapshots.getToken();
}
} while (resumeToken != null && !resumeToken.equalsIgnoreCase("null"));
} catch (IsilonException e) {
_log.error("listing snapshot by file policy failed.", e);
return BiosCommandResult.createErrorResult(e);
}
Task task = TaskUtils.findTaskForRequestId(_dbClient, fs.getId(), args.getOpId());
// set task to completed and progress to 100 and store in DB, so waiting thread in apisvc can read it.
task.ready();
task.setProgress(100);
_dbClient.updateObject(task);
return BiosCommandResult.createSuccessfulResult();
}
use of com.emc.storageos.isilon.restapi.IsilonException 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.IsilonException 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.IsilonException 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);
}
}
use of com.emc.storageos.isilon.restapi.IsilonException in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doExport.
@Override
public BiosCommandResult doExport(StorageSystem storage, FileDeviceInputOutput args, List<FileExport> exportList) throws ControllerException {
// Snapshot Export operation is not supported by ISILON.
if (args.getFileOperation() == false) {
return BiosCommandResult.createErrorResult(DeviceControllerErrors.isilon.unSupportedOperation(EXPORT_OP_NAME));
}
try {
_log.info("IsilonFileStorageDevice doExport {} - start", args.getFileObjId());
IsilonApi isi = getIsilonDevice(storage);
isiExport(isi, args, exportList);
_log.info("IsilonFileStorageDevice doExport {} - complete", args.getFileObjId());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("doExport failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
Aggregations