use of com.emc.vipr.model.sys.healthmonitor.StorageStats in project coprhd-controller by CoprHD.
the class HealthMonitorService method getStorageStats.
/**
* Get the current capacity for object, file and block storage.
*
* @brief Show storage capacity
* @prereq none
* @return Storage stats for controller (file & block) and object.
*/
@GET
@Path("/storage")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public StorageStats getStorageStats() {
_log.info("Getting storage stats");
StorageStats.ControllerStorageStats controllerStats = null;
if (_licenseManager.isProductLicensed(LicenseType.CONTROLLER)) {
ManagedResourcesCapacity resourceCapacities = _licenseManager.getControllerCapacity();
controllerStats = new StorageStats.ControllerStorageStats();
for (ManagedResourceCapacity cap : resourceCapacities.getResourceCapacityList()) {
switch(cap.getType()) {
case VOLUME:
controllerStats.setBlockCapacityKB(cap.getResourceCapacity() / StatConstants.CAPACITY_CONVERSION_VALUE);
break;
case FILESHARE:
controllerStats.setFileCapacityKB(cap.getResourceCapacity() / StatConstants.CAPACITY_CONVERSION_VALUE);
break;
case POOL:
controllerStats.setFreeManagedCapacityKB(cap.getResourceCapacity() / StatConstants.CAPACITY_CONVERSION_VALUE);
break;
case BUCKET:
controllerStats.setObjectCapacityKB(cap.getResourceCapacity() / StatConstants.CAPACITY_CONVERSION_VALUE);
break;
}
}
}
return new StorageStats(controllerStats);
}
Aggregations