use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doDisconnect.
@Override
public void doDisconnect(StorageSystem storage) {
try {
_logger.info("doConnect {} - start", storage.getId());
VNXeApiClient client = getVnxeClient(storage);
client.logout();
String msg = String.format("doDisconnect %1$s - complete", storage.getId());
_logger.info(msg);
} catch (VNXeException e) {
_logger.error("doDisconnect failed.", e);
throw DeviceControllerException.exceptions.disconnectStorageFailed(e);
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doCreateFS.
@Override
public BiosCommandResult doCreateFS(StorageSystem storage, FileDeviceInputOutput fileInOut) throws ControllerException {
_logger.info("creating file system: ", fileInOut.getFsName());
Long fsSize = fileInOut.getFsCapacity();
if (fsSize < 1) {
// Invalid size throw an error
_logger.error("doCreateFS failed : FileSystem size in bytes is not valid {}", fileInOut.getFsCapacity());
ServiceError error = DeviceControllerErrors.vnxe.unableToCreateFileSystem("FileSystem size in bytes is not valid");
return BiosCommandResult.createErrorResult(error);
}
VNXeFileTaskCompleter completer = null;
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = null;
try {
FileShare fs = fileInOut.getFs();
URI port = fs.getStoragePort();
if (port == null) {
_logger.error("No storageport uri found in the fs");
ServiceError error = DeviceControllerErrors.vnxe.unableToCreateFileSystem("No storageport uri found in the fs");
return BiosCommandResult.createErrorResult(error);
}
StoragePort portObj = _dbClient.queryObject(StoragePort.class, port);
URI haDomainUri = portObj.getStorageHADomain();
StorageHADomain haDomainObj = _dbClient.queryObject(StorageHADomain.class, haDomainUri);
StringSet protocols = fs.getProtocol();
if (protocols.contains(StorageProtocol.File.NFS_OR_CIFS.name())) {
/*
* the protocol is set to NFS_OR_CIFS, only if virtual pool's protocol is not set
* and the pool's protocol is set to NFS_OR_CIFS, since pool's protocol is set based on
* storageHADomain's protocol, setting the protocols to the selected StorageHADomain.
*/
protocols = haDomainObj.getFileSharingProtocols();
}
VNXeFSSupportedProtocolEnum protocolEnum = null;
if (protocols.contains(StorageProtocol.File.NFS.name()) && protocols.contains(StorageProtocol.File.CIFS.name())) {
protocolEnum = VNXeFSSupportedProtocolEnum.NFS_CIFS;
} else if (protocols.contains(StorageProtocol.File.NFS.name())) {
protocolEnum = VNXeFSSupportedProtocolEnum.NFS;
} else if (protocols.contains(StorageProtocol.File.CIFS.name())) {
protocolEnum = VNXeFSSupportedProtocolEnum.CIFS;
} else {
_logger.error("protocol is not support: " + protocols);
ServiceError error = DeviceControllerErrors.vnxe.unableToCreateFileSystem("protocol is not support:" + protocols);
return BiosCommandResult.createErrorResult(error);
}
job = apiClient.createFileSystem(fileInOut.getFsName(), fsSize, fileInOut.getPoolNativeId(), haDomainObj.getSerialNumber(), fileInOut.getThinProvision(), protocolEnum);
if (job != null) {
_logger.info("opid:" + fileInOut.getOpId());
completer = new VNXeFileTaskCompleter(FileShare.class, fileInOut.getFsId(), fileInOut.getOpId());
if (fileInOut.getFs() == null) {
_logger.error("Could not find the fs object");
}
VNXeCreateFileSystemJob createFSJob = new VNXeCreateFileSystemJob(job.getId(), storage.getId(), completer, fileInOut.getPoolId());
ControllerServiceImpl.enqueueJob(new QueueJob(createFSJob));
} else {
_logger.error("No job returned from creatFileSystem");
ServiceError error = DeviceControllerErrors.vnxe.unableToCreateFileSystem("No Job returned from createFileSystem");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create file system got the exception", e);
if (completer != null) {
completer.error(_dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateFileSystem", 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, Pool:%s, fileSystem: %s", storage.getSerialNumber(), fileInOut.getPoolNativeId(), fileInOut.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doExpandVolume.
@Override
public void doExpandVolume(StorageSystem storage, StoragePool pool, Volume volume, Long size, TaskCompleter taskCompleter) throws DeviceControllerException {
_logger.info(String.format("Expand Volume Start - Array: %s, Pool: %s, Volume: %s, New size: %d", storage.getSerialNumber(), pool.getNativeGuid(), volume.getLabel(), size));
String consistencyGroupId = null;
URI consistencyGroupURI = volume.getConsistencyGroup();
if (consistencyGroupURI != null) {
BlockConsistencyGroup consistencyGroup = _dbClient.queryObject(BlockConsistencyGroup.class, consistencyGroupURI);
if (consistencyGroup != null) {
consistencyGroupId = consistencyGroup.getCgNameOnStorageSystem(storage.getId());
}
}
try {
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob commandJob = apiClient.expandLun(volume.getNativeId(), size, consistencyGroupId);
VNXeExpandVolumeJob expandVolumeJob = new VNXeExpandVolumeJob(commandJob.getId(), storage.getId(), taskCompleter);
ControllerServiceImpl.enqueueJob(new QueueJob(expandVolumeJob));
} catch (VNXeException e) {
_logger.error("Expand volume got the exception", e);
taskCompleter.error(_dbClient, e);
} catch (Exception ex) {
_logger.error("Expand volume got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("ExpandVolume", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doDeleteFS.
/*
* @Override
* public BiosCommandResult doDeleteFS(StorageSystem storage,
* FileDeviceInputOutput fileInOut) throws ControllerException {
* _logger.info("deleting file system: ", fileInOut.getFsName());
* VNXeApiClient apiClient = getVnxeClient(storage);
* VNXeCommandJob job = null;
* VNXeFileTaskCompleter completer = null;
* try {
* job = apiClient.deleteFileSystem(fileInOut.getFsNativeId(), fileInOut.getForceDelete());
* if (job != null) {
* completer = new VNXeFileTaskCompleter(FileShare.class, fileInOut.getFsId(), fileInOut.getOpId(),
* OperationTypeEnum.DELETE_FILE_SYSTEM);
* VNXeDeleteFileSystemJob deleteFSJob = new VNXeDeleteFileSystemJob(job.getId(), storage.getId(),
* completer, fileInOut.getForceDelete());
* ControllerServiceImpl.enqueueJob(new QueueJob(deleteFSJob));
* } else {
* _logger.error("No job returned from deleteFileSystem");
* ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem",
* "No Job returned from deleteFileSystem");
* return BiosCommandResult.createErrorResult(error);
* }
*
* }catch (VNXeException e) {
* _logger.error("Delete file system got the exception", e);
* if (completer != null) {
* completer.error(_dbClient, e);
* }
* return BiosCommandResult.createErrorResult(e);
* } catch (Exception ex) {
* _logger.error("Delete file system got the exception", ex);
* ServiceError error = DeviceControllerErrors.vnxe.jobFailed("DeleteFileSystem", ex.getMessage());
* if (completer != null) {
* completer.error(_dbClient, error);
* }
* return BiosCommandResult.createErrorResult(error);
* }
* StringBuilder logMsgBuilder = new StringBuilder(String.format(
* "Delete filesystem job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(),
* fileInOut.getFsName()));
* _logger.info(logMsgBuilder.toString());
* return BiosCommandResult.createPendingResult();
* }
*/
/*
* 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 = getVnxeClient(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;
}
use of com.emc.storageos.vnxe.VNXeException in project coprhd-controller by CoprHD.
the class VNXeStorageDevice method doSnapshotFS.
@Override
public BiosCommandResult doSnapshotFS(StorageSystem storage, FileDeviceInputOutput args) throws ControllerException {
_logger.info("creating file system {} snap {} ", args.getFsName(), args.getSnapshotLabel());
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = null;
VNXeFSSnapshotTaskCompleter completer = null;
try {
job = apiClient.createFileSystemSnap(args.getFsNativeId(), args.getSnapshotName());
if (job != null) {
completer = new VNXeFSSnapshotTaskCompleter(Snapshot.class, args.getSnapshotId(), args.getOpId());
VNXeCreateFileSystemSnapshotJob snapJob = new VNXeCreateFileSystemSnapshotJob(job.getId(), storage.getId(), completer);
ControllerServiceImpl.enqueueJob(new QueueJob(snapJob));
} else {
_logger.error("No job returned from createFileSystemSnap");
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("snapshotFileSystem", "No Job returned from createFileSystemSnap");
return BiosCommandResult.createErrorResult(error);
}
} catch (VNXeException e) {
_logger.error("Create file system snapshot got the exception", e);
if (completer != null) {
completer.error(_dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system snpashot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateFileSystemSnapshot", ex.getMessage());
if (completer != null) {
completer.error(_dbClient, error);
}
return BiosCommandResult.createErrorResult(error);
}
StringBuilder logMsgBuilder = new StringBuilder(String.format("Create filesystem snapshot job submitted - Array:%s, fileSystem: %s", storage.getSerialNumber(), args.getFsName()));
_logger.info(logMsgBuilder.toString());
return BiosCommandResult.createPendingResult();
}
Aggregations