use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class UnManagedFilesystemService method doesNASServerSupportVPoolProtocols.
/**
* Checks the NAS server protocols with vpool protocols
*
* @param nasUri the NAS server ID
* @param vpoolProtocols the protocols configured in vpool
* @return true if NAS server protocols matches with vpool protocols; false otherwise
*/
private boolean doesNASServerSupportVPoolProtocols(String nasUri, StringSet vpoolProtocols) {
NASServer nasServer = null;
boolean supports = false;
boolean isVNAS = false;
if (StringUtils.equals("VirtualNAS", URIUtil.getTypeName(nasUri))) {
nasServer = _dbClient.queryObject(VirtualNAS.class, URI.create(nasUri));
isVNAS = true;
} else {
nasServer = _dbClient.queryObject(PhysicalNAS.class, URI.create(nasUri));
}
if (nasServer != null) {
StringSet nasProtocols = nasServer.getProtocols();
if (isVNAS) {
if (VirtualNasState.LOADED.name().equals(nasServer.getNasState())) {
_logger.info("NAS server is: {}. Supported protocols: {}. Vpool protocols: {}", nasServer.getNasName(), nasProtocols, vpoolProtocols);
supports = nasProtocols.containsAll(vpoolProtocols);
} else {
_logger.warn("NAS server: {} not in LOADED state. So this vNAS server is not supported.", nasServer.getNasName());
supports = false;
}
} else {
// Perform check on Physical NAS
supports = nasProtocols.containsAll(vpoolProtocols);
}
}
return supports;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class VirtualNasService method getVirtualNasServers.
/**
* Gets the ids and self links for all virtual NAS.
*
* @brief List virtual NAS servers
* @return A VirtualNASList reference specifying the ids and self links for
* the virtual NAS servers.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public VirtualNASList getVirtualNasServers() {
VirtualNASList vNasList = new VirtualNASList();
List<URI> ids = _dbClient.queryByType(VirtualNAS.class, true);
for (URI id : ids) {
VirtualNAS vNas = _dbClient.queryObject(VirtualNAS.class, id);
if ((vNas != null)) {
vNasList.getVNASServers().add(toNamedRelatedResource(vNas, vNas.getNasName()));
}
}
return vNasList;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method getCustomPath.
/**
* Gets the file system custom path value from controller configuration
*
* @param storage
* Isilon storage system
* @param args
* FileDeviceInputOutput object
* @return evaluated custom path
*/
private String getCustomPath(StorageSystem storage, FileDeviceInputOutput args) {
String path = "";
IsilonApi isi = getIsilonDevice(storage);
String clusterName = isi.getClusterConfig().getName();
FileShare fs = args.getFs();
// source cluster name should be included in target path instead of target cluster name.
if (fs != null && fs.getPersonality() != null && fs.getPersonality().equalsIgnoreCase(PersonalityTypes.TARGET.name())) {
FileShare sourceFS = _dbClient.queryObject(FileShare.class, fs.getParentFileShare());
if (sourceFS != null && sourceFS.getStorageDevice() != null) {
StorageSystem sourceSystem = _dbClient.queryObject(StorageSystem.class, sourceFS.getStorageDevice());
if (sourceSystem != null) {
IsilonApi sourceCluster = getIsilonDevice(sourceSystem);
clusterName = sourceCluster.getClusterConfig().getName();
// if the replication happens from user defined access zone to system access zone!!
if (sourceFS.getVirtualNAS() != null) {
VirtualNAS sourcevNAS = _dbClient.queryObject(VirtualNAS.class, sourceFS.getVirtualNAS());
if (sourcevNAS != null) {
String vNASName = sourcevNAS.getNasName();
vNASName = getNameWithNoSpecialCharacters(vNASName, args);
clusterName = clusterName + vNASName;
_log.info("Source file system is on virtual NAS {}", vNASName);
}
}
_log.debug("Generating path for target and the source cluster is is {}", clusterName);
}
}
} else if (args.isTarget()) {
if (args.getSourceSystem() != null) {
IsilonApi sourceCluster = getIsilonDevice(args.getSourceSystem());
clusterName = sourceCluster.getClusterConfig().getName();
}
// if the replication happens from user defined access zone to system access zone!!
if (args.getSourceVNAS() != null && args.getvNAS() == null) {
VirtualNAS sourcevNAS = args.getSourceVNAS();
String vNASName = sourcevNAS.getNasName();
vNASName = getNameWithNoSpecialCharacters(vNASName, args);
clusterName = clusterName + vNASName;
}
_log.debug("Generating path for target and the source cluster is is {}", clusterName);
}
DataSource dataSource = dataSourceFactory.createIsilonFileSystemPathDataSource(args.getProject(), args.getVPool(), args.getTenantOrg(), storage);
dataSource.addProperty(CustomConfigConstants.ISILON_CLUSTER_NAME, clusterName);
String configPath = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.ISILON_PATH_CUSTOMIZATION, "isilon", dataSource);
_log.debug("The isilon user defined custom path is {}", configPath);
if (configPath != null && !configPath.isEmpty()) {
path = args.getPathWithoutSpecialCharacters(configPath);
}
return path;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method getFilePolicyPath.
private String getFilePolicyPath(StorageSystem storageObj, String applyAt, FileDeviceInputOutput args) {
String customPath = getCustomPath(storageObj, args);
String filePolicyBasePath = null;
VirtualNAS vNAS = args.getvNAS();
if (vNAS != null) {
String vNASPath = vNAS.getBaseDirPath();
if (vNASPath != null && !vNASPath.trim().isEmpty()) {
filePolicyBasePath = vNASPath + FW_SLASH + customPath;
} else {
filePolicyBasePath = IFS_ROOT + FW_SLASH + getSystemAccessZoneNamespace() + FW_SLASH + customPath;
}
} else {
filePolicyBasePath = IFS_ROOT + FW_SLASH + getSystemAccessZoneNamespace() + FW_SLASH + customPath;
}
filePolicyBasePath = filePolicyBasePath.replaceAll("/+", "/").replaceAll("/$", "");
filePolicyBasePath = truncatePathUptoApplyAtLevel(filePolicyBasePath, applyAt, args);
_log.info("Computed file policy path: {}", filePolicyBasePath);
return filePolicyBasePath;
}
use of com.emc.storageos.db.client.model.VirtualNAS in project coprhd-controller by CoprHD.
the class IsilonFileStorageDevice method doCheckFSDependencies.
@Override
public BiosCommandResult doCheckFSDependencies(StorageSystem storage, FileDeviceInputOutput args) {
_log.info("Checking file system {} has dependencies in storage array: {}", args.getFsName(), storage.getLabel());
boolean hasDependency = true;
String vnasName = null;
VirtualNAS vNas = args.getvNAS();
if (vNas != null) {
vnasName = vNas.getNasName();
}
try {
String fsMountPath = args.getFsMountPath();
hasDependency = doesNFSExportExistsForFSPath(storage, vnasName, fsMountPath);
if (!hasDependency) {
hasDependency = doesCIFSShareExistsForFSPath(storage, vnasName, fsMountPath);
}
if (!hasDependency) {
hasDependency = doesSnapshotExistsForFSPath(storage, vnasName, fsMountPath);
}
if (hasDependency) {
_log.error("File system has dependencies on array: {}", args.getFsName());
DeviceControllerException e = DeviceControllerException.exceptions.fileSystemHasDependencies(fsMountPath);
return BiosCommandResult.createErrorResult(e);
}
_log.info("File system has no dependencies on array: {}", args.getFsName());
return BiosCommandResult.createSuccessfulResult();
} catch (IsilonException e) {
_log.error("Checking FS dependencies failed.", e);
throw e;
}
}
Aggregations