Search in sources :

Example 1 with UnManagedFileSystemList

use of com.emc.storageos.model.file.UnManagedFileSystemList in project coprhd-controller by CoprHD.

the class StorageSystemService method getUnManagedFileSystems.

/**
 * List all unmanaged file systems which are available for a storage system.Unmanaged file systems refers to file systems which are
 * available within underlying storage systems , but
 * still not managed in ViPR.
 * As these file systems are not managed in ViPR, there will not be any ViPR specific
 * details associated such as, virtual array, virtual pool, or project.
 *
 * @param id the URN of a ViPR storage system
 *
 * @prereq none
 * @brief List of all unmanaged file systems available for a storage system
 * @return UnManagedFileSystemList
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}/unmanaged/filesystems")
public UnManagedFileSystemList getUnManagedFileSystems(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
    UnManagedFileSystemList unManagedFileSystemList = new UnManagedFileSystemList();
    URIQueryResultList result = new URIQueryResultList();
    _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceUnManagedFileSystemConstraint(id), result);
    Iterator<UnManagedFileSystem> unmanagedFileSystemItr = _dbClient.queryIterativeObjects(UnManagedFileSystem.class, result, true);
    while (unmanagedFileSystemItr.hasNext()) {
        UnManagedFileSystem umfs = unmanagedFileSystemItr.next();
        unManagedFileSystemList.getUnManagedFileSystem().add(toRelatedResource(ResourceTypeEnum.UNMANAGED_FILESYSTEMS, umfs.getId()));
    }
    return unManagedFileSystemList;
}
Also used : UnManagedFileSystemList(com.emc.storageos.model.file.UnManagedFileSystemList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with UnManagedFileSystemList

use of com.emc.storageos.model.file.UnManagedFileSystemList in project coprhd-controller by CoprHD.

the class UnManagedFileSystems method listByStorageSystemVirtualPool.

/**
 * Lists the unmanaged file systems for the given storage system and virtual pool
 * <p>
 * API Call: <tt>GET /vdc/storage-systems/{storageSystemId}/unmanaged/{virtualPool}/filesystems</tt>
 *
 * @param storageSystemId the ID of the storage system
 * @param vpool the ID of the virtual pool
 * @param exported if true, return exported filesystems. if false, return unexported filesystems
 * @return list of unmanaged filesystems
 */
public List<NamedRelatedResourceRep> listByStorageSystemVirtualPool(URI storageSystemId, URI vpool, boolean exported) {
    String exportType = exported ? EXPORTED : UNEXPORTED;
    URI path = client.uriBuilder(PathConstants.UNMANAGED_FILESYSTEM_BY_STORAGE_SYSTEM_VIRTUAL_POOL_URL).queryParam("exportType", exportType).build(storageSystemId, vpool);
    UnManagedFileSystemList response = client.getURI(UnManagedFileSystemList.class, path);
    return ResourceUtils.defaultList(response.getNamedUnManagedFileSystem());
}
Also used : UnManagedFileSystemList(com.emc.storageos.model.file.UnManagedFileSystemList) URI(java.net.URI)

Example 3 with UnManagedFileSystemList

use of com.emc.storageos.model.file.UnManagedFileSystemList in project coprhd-controller by CoprHD.

the class StorageSystemService method getUnManagedVPoolFileSystems.

/**
 * List all unmanaged FileSystems that are available for a storage system &
 * given vpool.
 *
 * Unmanaged FileSystems refers to volumes which are available within
 * underlying storage systems, but still not managed in ViPR. As these
 * FileSystems are not managed in ViPR, there will not be any ViPR specific
 * details associated such as, virtual array, virtual pool, or project.
 *
 * @param id
 *            the URN of a ViPR storage system
 * @prereq none
 * @param vPoolId
 *            the URN of the Virtual Pool
 * @param exportType
 *            Specifies the type of UnManaged FileSystem.
 * @brief List of all unmanaged filesystems available for a storage system & vpool
 * @return UnManagedFileSystemList
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}/unmanaged/{vpoolid}/filesystems")
public UnManagedFileSystemList getUnManagedVPoolFileSystems(@PathParam("id") URI id, @PathParam("vpoolid") URI vPoolId, @QueryParam("exportType") String exportType) {
    ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
    ArgValidator.checkFieldUriType(vPoolId, VirtualPool.class, "id");
    if (exportType == null || exportType.trim().length() < 1) {
        exportType = ExportType.UNEXPORTED.toString();
    }
    if (ExportType.lookup(exportType) == null) {
        throw APIException.badRequests.invalidParameterForUnManagedVolumeQuery(exportType);
    }
    String isExportedSelected = exportType.equalsIgnoreCase(ExportType.EXPORTED.name()) ? TRUE_STR : FALSE_STR;
    UnManagedFileSystemList unManagedFileSystemList = new UnManagedFileSystemList();
    URIQueryResultList result = new URIQueryResultList();
    _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getUnManagedFileSystemSupportedVPoolConstraint(vPoolId.toString()), result);
    Iterator<UnManagedFileSystem> unmanagedFileSystemItr = _dbClient.queryIterativeObjects(UnManagedFileSystem.class, result, true);
    while (unmanagedFileSystemItr.hasNext()) {
        UnManagedFileSystem umfs = unmanagedFileSystemItr.next();
        String umfsExportStatus = umfs.getFileSystemCharacterstics().get(SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString());
        if (umfs.getStorageSystemUri().equals(id) && null != umfsExportStatus && isExportedSelected.equalsIgnoreCase(umfsExportStatus)) {
            String name = (null == umfs.getLabel()) ? umfs.getNativeGuid() : umfs.getLabel();
            unManagedFileSystemList.getNamedUnManagedFileSystem().add(toNamedRelatedResource(ResourceTypeEnum.UNMANAGED_FILESYSTEMS, umfs.getId(), name));
        } else {
            _log.info("Ignoring unmanaged filesystem: {}", umfs.getNativeGuid());
        }
    }
    return unManagedFileSystemList;
}
Also used : UnManagedFileSystemList(com.emc.storageos.model.file.UnManagedFileSystemList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

UnManagedFileSystemList (com.emc.storageos.model.file.UnManagedFileSystemList)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 UnManagedFileSystem (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 URI (java.net.URI)1