Search in sources :

Example 1 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class SystemsMapper method map.

public static StoragePoolRestRep map(StoragePool from, Map<String, Long> capacityMetrics, boolean isBlockStoragePool, CoordinatorClient coordinatorClient) {
    if (from == null) {
        return null;
    }
    StoragePoolRestRep to = new StoragePoolRestRep();
    mapDiscoveredDataObjectFields(from, to);
    to.setProtocols(from.getProtocols());
    to.setControllerParams(new StringMapAdapter().marshal(from.getControllerParams()));
    to.setOperationalStatus(from.getOperationalStatus());
    to.setTotalCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.USABLE.toString()));
    to.setFreeCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.FREE.toString()));
    to.setUsedCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.USED.toString()));
    to.setPercentUsed(capacityMetrics.get(CapacityUtils.StorageMetrics.PERCENT_USED.toString()));
    if ((null != capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()) && !(capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()).toString().equals(MINUS_ONE_LONG)))) {
        to.setSubscribedCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()));
        to.setPercentSubscribed(capacityMetrics.get(CapacityUtils.StorageMetrics.PERCENT_SUBSCRIBED.toString()));
    }
    to.setMaximumThinVolumeSize(CapacityUtils.convertKBToGB(from.getMaximumThinVolumeSize()));
    to.setMinimumThinVolumeSize(CapacityUtils.convertKBToGB(from.getMinimumThinVolumeSize()));
    to.setMaximumThickVolumeSize(CapacityUtils.convertKBToGB(from.getMaximumThickVolumeSize()));
    to.setMinimumThickVolumeSize(CapacityUtils.convertKBToGB(from.getMinimumThickVolumeSize()));
    to.setMaxResources(from.getMaxResources());
    to.setAssignedVirtualArrays(from.getAssignedVirtualArrays());
    to.setConnectedVirtualArrays(from.getConnectedVirtualArrays());
    to.setTaggedVirtualArrays(from.getTaggedVirtualArrays());
    to.setRaidLevels(from.getSupportedRaidLevels());
    to.setThinVolumePreAllocationSupported(from.getThinVolumePreAllocationSupported());
    to.setAutoTieringSupported(from.getAutoTieringEnabled());
    to.setDriveTypes(from.getSupportedDriveTypes());
    to.setCopyTypes(from.getSupportedCopyTypes());
    to.setTierUtilizationPercentage(new StringMapAdapter().marshal(from.getTierUtilizationPercentage()));
    to.setPoolName(from.getPoolName());
    to.setPoolServiceType(from.getPoolServiceType());
    to.setLongTermRetention(from.getLongTermRetention());
    to.setSupportedResourceTypes(from.getSupportedResourceTypes());
    to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageDevice()));
    to.setRegistrationStatus(from.getRegistrationStatus());
    to.setCompatibilityStatus(from.getCompatibilityStatus());
    to.setDiscoveryStatus(from.getDiscoveryStatus());
    to.setDataCenters(from.getDataCenters());
    to.setCompressionEnabled(from.getCompressionEnabled());
    to.setMaxPoolUtilizationPercentage((from.getMaxPoolUtilizationPercentage() != null) ? from.getMaxPoolUtilizationPercentage() : Integer.valueOf(ControllerUtils.getPropertyValueFromCoordinator(coordinatorClient, CapacityMatcher.MAX_POOL_UTILIZATION_PERCENTAGE)));
    if (null != from.getSupportedResourceTypes() && !from.getSupportedResourceTypes().equals(StoragePool.SupportedResourceTypes.THICK_ONLY.name())) {
        to.setMaxThinPoolSubscriptionPercentage((from.getMaxThinPoolSubscriptionPercentage() != null) ? from.getMaxThinPoolSubscriptionPercentage() : Integer.valueOf(ControllerUtils.getPropertyValueFromCoordinator(coordinatorClient, CapacityMatcher.MAX_THIN_POOL_SUBSCRIPTION_PERCENTAGE)));
    }
    return to;
}
Also used : StringMapAdapter(com.emc.storageos.model.adapters.StringMapAdapter) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep)

Example 2 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class StoragePoolService method getStoragePool.

/**
 * Gets the data for a storage pool.
 *
 * @param id the URN of a ViPR storage pool.
 *
 * @brief Show storage pool
 * @return A StoragePoolRestRep reference specifying the data for the
 *         storage pool with the passed id.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StoragePoolRestRep getStoragePool(@PathParam("id") URI id) {
    ArgValidator.checkFieldUriType(id, StoragePool.class, "id");
    StoragePool storagePool = queryResource(id);
    ArgValidator.checkEntity(storagePool, id, isIdEmbeddedInURL(id));
    StoragePoolRestRep restRep = toStoragePoolRep(storagePool, _dbClient, _coordinator);
    restRep.setNumResources(getNumResources(storagePool, _dbClient));
    return restRep;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class StoragePoolService method queryBulkResourceReps.

@Override
public StoragePoolBulkRep queryBulkResourceReps(List<URI> ids) {
    Iterator<StoragePool> _dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
    return new StoragePoolBulkRep(BulkList.wrapping(_dbIterator, new Function<StoragePool, StoragePoolRestRep>() {

        @Override
        public StoragePoolRestRep apply(StoragePool storagePool) {
            StoragePoolRestRep restRep = toStoragePoolRep(storagePool, _dbClient, _coordinator);
            restRep.setNumResources(getNumResources(storagePool, _dbClient));
            return restRep;
        }
    }));
}
Also used : Function(com.google.common.base.Function) StoragePool(com.emc.storageos.db.client.model.StoragePool) StoragePoolBulkRep(com.emc.storageos.model.pools.StoragePoolBulkRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep)

Example 4 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class StorageSystems method savePool.

@FlashException(keep = true, referrer = { "editPool" })
public static void savePool(StorageArrayPoolForm storageArrayPool) {
    storageArrayPool.validate("storageArrayPool");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    StoragePoolRestRep pool = storageArrayPool.save();
    flash.success(MessagesUtils.get(SAVED_POOL, pool.getPoolName()));
    pools(stringId(pool.getStorageSystem()));
}
Also used : StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) FlashException(controllers.util.FlashException)

Example 5 with StoragePoolRestRep

use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.

the class StorageSystems method arrayPoolsJson.

public static void arrayPoolsJson(String id) {
    List<StoragePoolInfo> results = Lists.newArrayList();
    List<StoragePoolRestRep> storagePools = StoragePoolUtils.getStoragePools(id);
    for (StoragePoolRestRep storagePool : storagePools) {
        if (!DiscoveredDataObject.DiscoveryStatus.NOTVISIBLE.name().equals(storagePool.getDiscoveryStatus())) {
            results.add(new StoragePoolInfo(storagePool));
        }
    }
    renderJSON(DataTablesSupport.createJSON(results, params));
}
Also used : StoragePoolInfo(models.datatable.StoragePoolDataTable.StoragePoolInfo) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep)

Aggregations

StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)17 StoragePoolInfo (models.datatable.StoragePoolDataTable.StoragePoolInfo)7 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)5 URI (java.net.URI)5 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 BlockVirtualPoolForm (models.virtualpool.BlockVirtualPoolForm)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StringMapAdapter (com.emc.storageos.model.adapters.StringMapAdapter)1 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)1 StoragePoolBulkRep (com.emc.storageos.model.pools.StoragePoolBulkRep)1 StoragePoolUpdate (com.emc.storageos.model.pools.StoragePoolUpdate)1 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)1 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)1 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 Task (com.emc.vipr.client.Task)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 IdFilter (com.emc.vipr.client.core.filters.IdFilter)1 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)1