public static boolean checkPoolMaximumResourcesApproached(StoragePool pool,DbClient dbClient,Integer resourceCount){
  if (pool.getIsResourceLimitSet()) {
    Integer poolResources=getNumResources(pool,dbClient);
    if (pool.getMaxResources() < (poolResources + resourceCount)) {
      _log.info("Ignoring Storage pool {} since it's approaching Resource limit: {}. ",pool.getNativeGuid(),pool.getMaxResources());
      return true;
    }
  }
  URI systemId=pool.getStorageDevice();
  StorageSystem system=dbClient.queryObject(StorageSystem.class,systemId);
  if (system.getIsResourceLimitSet()) {
    Integer systemResources=getNumResources(system,dbClient);
    if (system.getMaxResources() < (systemResources + resourceCount)) {
      _log.info("Ignoring Storage system {} pools since it's approaching Resource limit: {}. ",system.getNativeGuid(),system.getMaxResources());
      return true;
    }
  }
  return false;
}

public static boolean checkPoolMaximumResourcesApproached ( StoragePool pool , DbClient dbClient , Integer resourceCount ) { if ( pool . getIsResourceLimitSet ( ) ) { Integer poolResources = getNumResources ( pool , dbClient ) ; if ( pool . getMaxResources ( ) < ( poolResources + resourceCount ) ) { _log . info ( "Ignoring Storage pool {} since it's approaching Resource limit: {}. " , pool . getNativeGuid ( ) , pool . getMaxResources ( ) ) ; return true ; } } URI systemId = pool . getStorageDevice ( ) ; StorageSystem system = dbClient . queryObject ( StorageSystem . class , systemId ) ; if ( system . getIsResourceLimitSet ( ) ) { Integer systemResources = getNumResources ( system , dbClient ) ; if ( system . getMaxResources ( ) < ( systemResources + resourceCount ) ) { _log . info ( "Ignoring Storage system {} pools since it's approaching Resource limit: {}. " , system . getNativeGuid ( ) , system . getMaxResources ( ) ) ; return true ; } } return false ; }
check whether pool & its system maximum resources approached or not .
