Search in sources :

Example 6 with XtremIOSystem

use of com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem in project coprhd-controller by CoprHD.

the class XtremIOProvUtils method updateStoragePoolCapacity.

public static void updateStoragePoolCapacity(XtremIOClient client, DbClient dbClient, StoragePool storagePool) {
    try {
        StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storagePool.getStorageDevice());
        _log.info(String.format("Old storage pool capacity data for %n  pool %s/%s --- %n  free capacity: %s; subscribed capacity: %s", storageSystem.getId(), storagePool.getId(), storagePool.calculateFreeCapacityWithoutReservations(), storagePool.getSubscribedCapacity()));
        List<XtremIOSystem> systems = client.getXtremIOSystemInfo();
        for (XtremIOSystem system : systems) {
            if (system.getSerialNumber().equalsIgnoreCase(storageSystem.getSerialNumber())) {
                storagePool.setFreeCapacity(system.getTotalCapacity() - system.getUsedCapacity());
                storagePool.setSubscribedCapacity(system.getSubscribedCapacity());
                dbClient.updateObject(storagePool);
                break;
            }
        }
        _log.info(String.format("New storage pool capacity data for %n  pool %s/%s --- %n  free capacity: %s; subscribed capacity: %s", storageSystem.getId(), storagePool.getId(), storagePool.calculateFreeCapacityWithoutReservations(), storagePool.getSubscribedCapacity()));
    } catch (Exception e) {
        _log.warn("Problem when updating pool capacity for pool {}", storagePool.getNativeGuid());
    }
}
Also used : XtremIOSystem(com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem) XtremIOApiException(com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

XtremIOSystem (com.emc.storageos.xtremio.restapi.model.response.XtremIOSystem)6 XtremIOApiException (com.emc.storageos.xtremio.restapi.errorhandling.XtremIOApiException)4 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 ArrayList (java.util.ArrayList)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 XtremIOClient (com.emc.storageos.xtremio.restapi.XtremIOClient)2 XtremIOCluster (com.emc.storageos.xtremio.restapi.model.response.XtremIOCluster)2 XtremIOClusterInfo (com.emc.storageos.xtremio.restapi.model.response.XtremIOClusterInfo)2 XtremIOClusters (com.emc.storageos.xtremio.restapi.model.response.XtremIOClusters)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 URI (java.net.URI)2 Host (com.emc.storageos.db.client.model.Host)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StoragePort (com.emc.storageos.db.client.model.StoragePort)1 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)1 List (java.util.List)1