Search in sources :

Example 16 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenterProvider method getUnmanagedFileSystemVirtualPools.

@Asset("unmanagedFileVirtualPool")
@AssetDependencies({ "fileStorageSystem", "virtualArray", "fileIngestExportType" })
public List<AssetOption> getUnmanagedFileSystemVirtualPools(AssetOptionsContext ctx, URI storageSystem, URI virtualArray, String ingestExportType) {
    Map<URI, Integer> vpools = getFileVirtualPools(listUnmanagedFilesystems(ctx, storageSystem), ingestExportType);
    Map<URI, FileVirtualPoolRestRep> virtualPoolMap = FileProvider.getFileVirtualPools(api(ctx), vpools.keySet());
    List<AssetOption> options = Lists.newArrayList();
    for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
        FileVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
        if (isVirtualPoolInVirtualArray(vpool, virtualArray)) {
            options.add(newAssetOption(vpool.getId().toString(), "file.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) URI(java.net.URI) Map(java.util.Map) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 17 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class VirtualDataCenterProvider method getUnmanagedFileVirtualPools.

@Asset("unmanagedFileVirtualPool")
@AssetDependencies({ "fileStorageSystem" })
public List<AssetOption> getUnmanagedFileVirtualPools(AssetOptionsContext ctx, URI storageSystem) {
    Map<URI, Integer> vpools = getFileVirtualPools(listUnmanagedFilesystems(ctx, storageSystem));
    Map<URI, FileVirtualPoolRestRep> virtualPoolMap = FileProvider.getFileVirtualPools(api(ctx), vpools.keySet());
    List<AssetOption> options = Lists.newArrayList();
    for (Map.Entry<URI, Integer> entry : vpools.entrySet()) {
        FileVirtualPoolRestRep vpool = virtualPoolMap.get(entry.getKey());
        if (vpool != null) {
            options.add(newAssetOption(vpool.getId().toString(), "file.virtualPool.unmanaged", vpool.getName(), entry.getValue()));
        }
    }
    AssetOptionsUtils.sortOptionsByLabel(options);
    return options;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) AssetOption(com.emc.vipr.model.catalog.AssetOption) URI(java.net.URI) Map(java.util.Map) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 18 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class FileVirtualPoolService method getFileVirtualPool.

/**
 * Get info for File Store VirtualPool
 *
 * @param id the URN of a ViPR VirtualPool
 * @brief Show file store VirtualPool
 * @return VirtualPool details
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR }, acls = { ACL.USE })
public FileVirtualPoolRestRep getFileVirtualPool(@PathParam("id") URI id) {
    VirtualPool vpool = getVirtualPool(VirtualPool.Type.file, id);
    FileVirtualPoolRestRep restRep = toFileVirtualPool(vpool);
    restRep.setNumResources(getNumResources(vpool, _dbClient));
    return restRep;
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) VirtualPoolMapper.toFileVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool) MapFileVirtualPool(com.emc.storageos.api.mapper.functions.MapFileVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 19 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class FileProtectionPolicies method getVpoolForProtectionPolicy.

/**
 * This call return the pool or pools which can be associated with policy.
 * Currently this does not check vpool is assigned to another policy.
 * As we do not have direct reference of policy in file vpool and looping all
 * policy and then its assigned resource to figure out it is assign or not
 * is causing slowness in GUI.Will address this in future release
 *
 * @param id
 */
public static void getVpoolForProtectionPolicy(String id) {
    Collection<FileVirtualPoolRestRep> vPools = Lists.newArrayList();
    FilePolicyRestRep policy = getViprClient().fileProtectionPolicies().get(uri(id));
    if (policy.getAssignedResources() != null && !policy.getAssignedResources().isEmpty()) {
        NamedRelatedResourceRep vpoolNameRes = null;
        // get the first vpool and return it.
        if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.vpool.name())) {
            vpoolNameRes = policy.getAssignedResources().get(0);
        } else if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.project.name())) {
            vpoolNameRes = policy.getVpool();
        }
        if (vpoolNameRes != null) {
            FileVirtualPoolRestRep vpolRestep = getViprClient().fileVpools().get(vpoolNameRes.getId());
            vPools.add(vpolRestep);
            renderJSON(vPools);
            return;
        }
    }
    List<FileVirtualPoolRestRep> virtualPools = getViprClient().fileVpools().getAll();
    for (FileVirtualPoolRestRep vpool : virtualPools) {
        // first level filter based on the protection is enabled or not
        FileVirtualPoolProtectionParam protectParam = vpool.getProtection();
        if (protectParam == null) {
            continue;
        }
        // 2nde level filter based on the applied level of policy and the pool
        if (FilePolicyApplyLevel.project.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtProjectLevel()) {
            continue;
        }
        if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtFSLevel()) {
            continue;
        }
        // now add pool into list if matches protection type with policy
        if (FilePolicyType.file_snapshot.name().equalsIgnoreCase(policy.getType()) && protectParam.getScheduleSnapshots()) {
            vPools.add(vpool);
        } else if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getType()) && protectParam.getReplicationSupported()) {
            vPools.add(vpool);
        }
    }
    renderJSON(vPools);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 20 with FileVirtualPoolRestRep

use of com.emc.storageos.model.vpool.FileVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class FileSystems method fileSystem.

public static void fileSystem(String fileSystemId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    FileShareRestRep fileSystem = null;
    try {
        fileSystem = client.fileSystems().get(uri(fileSystemId));
    } catch (ViPRHttpException e) {
        if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
            flash.error(MessagesUtils.get(UNKNOWN, fileSystemId));
            fileSystems(null);
        }
        throw e;
    }
    if (fileSystem != null) {
        if (fileSystem.getVirtualArray() != null) {
            VirtualArrayRestRep virtualArray = client.varrays().get(fileSystem.getVirtualArray());
            renderArgs.put("virtualArray", virtualArray);
        }
        if (fileSystem.getVirtualPool() != null) {
            FileVirtualPoolRestRep virtualPool = client.fileVpools().get(fileSystem.getVirtualPool());
            renderArgs.put("virtualPool", virtualPool);
        }
        if (Security.isSystemAdminOrRestrictedSystemAdmin()) {
            if (fileSystem.getStorageSystem() != null) {
                StorageSystemRestRep storageSystem = client.storageSystems().get(fileSystem.getStorageSystem());
                renderArgs.put("storageSystem", storageSystem);
            }
            if (fileSystem.getPool() != null) {
                StoragePoolRestRep storagePool = client.storagePools().get(fileSystem.getPool());
                renderArgs.put("storagePool", storagePool);
            }
            if (fileSystem.getStoragePort() != null) {
                StoragePortRestRep storagePort = client.storagePorts().get(fileSystem.getStoragePort());
                renderArgs.put("storagePort", storagePort);
            }
        }
        Tasks<FileShareRestRep> tasksResponse = client.fileSystems().getTasks(fileSystem.getId());
        List<Task<FileShareRestRep>> tasks = tasksResponse.getTasks();
        renderArgs.put("tasks", tasks);
    } else {
        notFound(MessagesUtils.get("resources.filesystems.notfound"));
    }
    renderArgs.put("permissionTypeOptions", PERMISSION_TYPES);
    render(fileSystem);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) Task(com.emc.vipr.client.Task) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) StoragePortRestRep(com.emc.storageos.model.ports.StoragePortRestRep) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) ViPRHttpException(com.emc.vipr.client.exceptions.ViPRHttpException)

Aggregations

FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)21 Asset (com.emc.sa.asset.annotation.Asset)8 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)7 URI (java.net.URI)7 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 AssetOption (com.emc.vipr.model.catalog.AssetOption)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)3 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)3 FileVirtualPoolProtectionParam (com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)3 Map (java.util.Map)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)2 FileVirtualPoolForm (models.virtualpool.FileVirtualPoolForm)2 VirtualPoolMapper.toFileVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool)1 MapFileVirtualPool (com.emc.storageos.api.mapper.functions.MapFileVirtualPool)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)1 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)1 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)1