use of com.emc.storageos.vnxe.models.VNXeFSSupportedProtocolEnum 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.models.VNXeFSSupportedProtocolEnum in project coprhd-controller by CoprHD.
the class VNXUnityFileStorageDevice 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 = getVnxUnityClient(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("The protocol is not supported: " + protocols);
ServiceError error = DeviceControllerErrors.vnxe.unableToCreateFileSystem("The protocol is not supported:" + 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 an exception", e);
if (completer != null) {
completer.error(dbClient, e);
}
return BiosCommandResult.createErrorResult(e);
} catch (Exception ex) {
_logger.error("Create file system got an 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();
}
Aggregations