Search in sources :

Example 1 with StorageStats

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);
}
Also used : StorageStats(com.emc.vipr.model.sys.healthmonitor.StorageStats) ManagedResourceCapacity(com.emc.storageos.model.vpool.ManagedResourcesCapacity.ManagedResourceCapacity) ManagedResourcesCapacity(com.emc.storageos.model.vpool.ManagedResourcesCapacity) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

ManagedResourcesCapacity (com.emc.storageos.model.vpool.ManagedResourcesCapacity)1 ManagedResourceCapacity (com.emc.storageos.model.vpool.ManagedResourcesCapacity.ManagedResourceCapacity)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 StorageStats (com.emc.vipr.model.sys.healthmonitor.StorageStats)1