GutoVeronezi commented on code in PR #8649: URL: https://github.com/apache/cloudstack/pull/8649#discussion_r1491402149
########## server/src/main/java/com/cloud/storage/StorageManagerImpl.java: ########## @@ -1254,7 +1254,8 @@ private boolean deleteDataStoreInternal(StoragePoolVO sPool, boolean forced) { // Check if the pool has associated volumes in the volumes table // If it does , then you cannot delete the pool if (vlms.first() > 0) { - throw new CloudRuntimeException("Cannot delete pool " + sPool.getName() + " as there are associated volumes for this pool"); + logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), getStoragePoolNonDestroyedVolumesLog(sPool.getId())); Review Comment: ```suggestion logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), () -> getStoragePoolNonDestroyedVolumesLog(sPool.getId())); ``` When executing heavy processes to load data only to log it, call the methods inside a lambda; this way, they will be evaluated only at the right log level. ########## server/src/main/java/com/cloud/storage/StorageManagerImpl.java: ########## @@ -1200,7 +1200,8 @@ public void doInTransactionWithoutResult(TransactionStatus status) { } }); } else { - throw new CloudRuntimeException("Cannot delete pool " + sPool.getName() + " as there are associated " + "non-destroyed vols for this pool"); + logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), getStoragePoolNonDestroyedVolumesLog(sPool.getId())); Review Comment: ```suggestion logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), () -> getStoragePoolNonDestroyedVolumesLog(sPool.getId())); ``` When executing heavy processes to load data only to log it, call the methods inside a lambda; this way, they will be evaluated only at the right log level. ########## server/src/main/java/com/cloud/storage/StorageManagerImpl.java: ########## @@ -1235,17 +1236,16 @@ private boolean deleteDataStoreInternal(StoragePoolVO sPool, boolean forced) { if (vlms.first() > 0) { Pair<Long, Long> nonDstrdVlms = volumeDao.getNonDestroyedCountAndTotalByPool(sPool.getId()); if (nonDstrdVlms.first() > 0) { - throw new CloudRuntimeException("Cannot delete pool " + sPool.getName() + " as there are associated " + "non-destroyed vols for this pool"); + logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), getStoragePoolNonDestroyedVolumesLog(sPool.getId())); Review Comment: ```suggestion logger.debug("Cannot delete storage pool {} as the following non-destroyed volumes are on it: {}.", sPool.getName(), () -> getStoragePoolNonDestroyedVolumesLog(sPool.getId())); ``` When executing heavy processes to load data only to log it, call the methods inside a lambda; this way, they will be evaluated only at the right log level. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org