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;
}
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;
}
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;
}
}));
}
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()));
}
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));
}
Aggregations