Search in sources :

Example 1 with CapacityResourceType

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

the class CapacityService method getCapacityDataResource.

private ManagedResourcesCapacity getCapacityDataResource() throws Exception {
    ManagedResourcesCapacity capacities = new ManagedResourcesCapacity();
    for (CapacityResourceType capType : CapacityResourceType.values()) {
        ManagedCapacityImpl.CapacityPropertyListTypes resourceType = ManagedCapacityImpl.mapCapacityType(capType);
        List<URI> dataResourcesURI = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getConstraint(PropertyListDataObject.class, "resourceType", resourceType.toString()));
        if (dataResourcesURI.isEmpty()) {
            _log.warn("Failed to find capacity of type {} in the database, recompute", resourceType);
            throw new Exception("Failed to find capacity in the database");
        }
        PropertyListDataObject resource = _dbClient.queryObject(PropertyListDataObject.class, dataResourcesURI.get(0));
        ManagedResourceCapacity mCap = map(resource, ManagedResourceCapacity.class);
        capacities.getResourceCapacityList().add(mCap);
    }
    return capacities;
}
Also used : PropertyListDataObject(com.emc.storageos.db.client.model.PropertyListDataObject) CapacityResourceType(com.emc.storageos.model.vpool.ManagedResourcesCapacity.CapacityResourceType) ManagedResourceCapacity(com.emc.storageos.model.vpool.ManagedResourcesCapacity.ManagedResourceCapacity) ManagedResourcesCapacity(com.emc.storageos.model.vpool.ManagedResourcesCapacity) ManagedCapacityImpl(com.emc.storageos.volumecontroller.impl.ManagedCapacityImpl) URI(java.net.URI) IOException(java.io.IOException)

Aggregations

PropertyListDataObject (com.emc.storageos.db.client.model.PropertyListDataObject)1 ManagedResourcesCapacity (com.emc.storageos.model.vpool.ManagedResourcesCapacity)1 CapacityResourceType (com.emc.storageos.model.vpool.ManagedResourcesCapacity.CapacityResourceType)1 ManagedResourceCapacity (com.emc.storageos.model.vpool.ManagedResourcesCapacity.ManagedResourceCapacity)1 ManagedCapacityImpl (com.emc.storageos.volumecontroller.impl.ManagedCapacityImpl)1 IOException (java.io.IOException)1 URI (java.net.URI)1