use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method getFSSnapshotList.
@Override
public BiosCommandResult getFSSnapshotList(StorageSystem storage, FileDeviceInputOutput fd, List<String> snapshots) throws ControllerException {
_logger.info("getFSSnapshotList {} - start", fd.getFsId());
VNXeApiClient client = getVnxUnityClient(storage);
try {
List<VNXeFileSystemSnap> snaps = client.getFileSystemSnaps(fd.getFsNativeId());
for (VNXeFileSystemSnap snap : snaps) {
snapshots.add(snap.getName());
}
return BiosCommandResult.createSuccessfulResult();
} catch (VNXeException e) {
_logger.error("getFSSnapshotList failed.", e);
return BiosCommandResult.createErrorResult(e);
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doExpandFS.
@Override
public BiosCommandResult doExpandFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("expanding file system: ", args.getFsName());
VNXeApiClient apiClient = getVnxUnityClient(storage);
VNXeCommandJob job = null;
VNXeFileTaskCompleter completer = null;
try {
job = apiClient.expandFileSystem(args.getFsNativeId(), args.getNewFSCapacity());
if (job != null) {
completer = new VNXeFileTaskCompleter(FileShare.class, args.getFsId(), args.getOpId());
VNXeExpandFileSystemJob expandFSJob = new VNXeExpandFileSystemJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(expandFSJob));
} else {
_logger.error("No job returned from expandFileSystem");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("expandFileSystem", "No Job returned from expandFileSystem");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Expand file system got the exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Expand file system got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("ExpandFileSystem", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Expand filesystem job submitted - Array:%s, fileSystem: %s, new size: %d", storage.getSerialNumber(), args.getFsName(), args.getNewFSCapacity()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doRestoreFS.
@Override
public BiosCommandResult doRestoreFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("restoring file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxUnityClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.restoreFileSystemSnap(args.getSnapNativeId());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeRestoreFileSystemSnapshotJob snapJob = new VNXeRestoreFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from restoreFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("restoreSnapshotFileSystem", "No Job returned from restoreFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Restore file system snapshot got the exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Restore file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("RestoreFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Restore filesystem snapshot job submitted - Array:%s, fileSystem: %s, snapshot: %s", storage.getSerialNumber(), args.getFsName(), args.getSnapshotLabel()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doCreateQuotaDirectory.
@Override
public BiosCommandResult doCreateQuotaDirectory(StorageSystem storage, FileDeviceInputOutput args, QuotaDirectory qd) throws ControllerException {
_logger.info("creating Quota Directory: ", args.getQuotaDirectoryName());
VNXUnityQuotaDirectoryTaskCompleter completer = null;
VNXeApiClient apiClient = getVnxUnityClient(storage);
VNXeCommandJob job = null;
try {
Long softLimit = 0L;
Long softGrace = 0L;
Long size = 0L;
if (qd.getSize() == 0) {
// If quota directory has no size specified, inherit it from the parent fs
size = args.getFsCapacity();
// for the calculation of limit sizes
} else {
size = qd.getSize();
}
// conversion from percentage to bytes
softLimit = Long.valueOf(qd.getSoftLimit() * size / 100);
// using hard limit
// conversion from days to seconds
softGrace = Long.valueOf(qd.getSoftGrace() * 24 * 60 * 60);
job = apiClient.createQuotaDirectory(args.getFsNativeId(), qd.getName(), qd.getSize(), softLimit, softGrace);
if (job != null) {
_logger.info("opid:" + args.getOpId());
completer = new VNXUnityQuotaDirectoryTaskCompleter(QuotaDirectory.class, args.getQuotaDirectory().getId(), args.getOpId());
if (args.getQuotaDirectory() == null) {
_logger.error("Could not find the quota object");
}
VNXUnityCreateFileSystemQuotaDirectoryJob createQuotaJob = new VNXUnityCreateFileSystemQuotaDirectoryJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(createQuotaJob));
} else {
_logger.error("No job returned from createQuotaDirectory");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("No Job returned from createQuotaDirectory");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create Quota Directory got an exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create Quota Directory got an exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateQuotaDirectory", ex.getMessage());
if (completer != null) {
completer.error(dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create filesystem job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice method doDeleteFS.
/*
* To get around the KH API delete file system async issues, using sync call for now.
*/
@Override
public BiosCommandResult doDeleteFS(StorageSystem storage, FileDeviceInputOutput fileInOut) throws ControllerException {
_logger.info("deleting file system: ", fileInOut.getFsName());
VNXeApiClient apiClient = getVnxUnityClient(storage);
BiosCommandResult result = null;
try {
apiClient.deleteFileSystemSync(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
StringBuilder logMsgBuilder = new StringBuilder(String.format("Deleted filesystem - Array:%s, fileSystem: %s", storage.getSerialNumber(), fileInOut.getFsName()));
_logger.info(logMsgBuilder.toString());
result = BiosCommandResult.createSuccessfulResult();
} catch (VNXeException e) {
_logger.error("Delete file system got the exception", e);
result = BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Delete file system got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
result = BiosCommandResult.createErrorResult(error);
}
return result;
}
Aggregations