Search in sources :

Example 11 with VirtualNAS

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;
}
Also used : NASServer(com.emc.storageos.db.client.model.NASServer) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) StringSet(com.emc.storageos.db.client.model.StringSet) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS)

Example 12 with VirtualNAS

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;
}
Also used : VirtualNASList(com.emc.storageos.model.vnas.VirtualNASList) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) URI(java.net.URI) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 13 with VirtualNAS

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;
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) FileShare(com.emc.storageos.db.client.model.FileShare) SMBFileShare(com.emc.storageos.db.client.model.SMBFileShare) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) DataSource(com.emc.storageos.customconfigcontroller.DataSource)

Example 14 with VirtualNAS

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;
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS)

Example 15 with VirtualNAS

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;
    }
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException)

Aggregations

VirtualNAS (com.emc.storageos.db.client.model.VirtualNAS)54 URI (java.net.URI)26 ArrayList (java.util.ArrayList)19 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)18 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)16 StringSet (com.emc.storageos.db.client.model.StringSet)15 PhysicalNAS (com.emc.storageos.db.client.model.PhysicalNAS)9 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)9 List (java.util.List)9 StoragePort (com.emc.storageos.db.client.model.StoragePort)8 URISyntaxException (java.net.URISyntaxException)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 FileDeviceInputOutput (com.emc.storageos.volumecontroller.FileDeviceInputOutput)7 Project (com.emc.storageos.db.client.model.Project)6 StringMap (com.emc.storageos.db.client.model.StringMap)6 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)6 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)6 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)6 ControllerException (com.emc.storageos.volumecontroller.ControllerException)6