slavkap commented on a change in pull request #4826:
URL: https://github.com/apache/cloudstack/pull/4826#discussion_r686708956



##########
File path: server/src/main/java/com/cloud/storage/StorageManagerImpl.java
##########
@@ -475,49 +478,40 @@ public Answer sendToPool(StoragePool pool, Command cmd) 
throws StorageUnavailabl
     }
 
     private GetStorageStatsAnswer getStoragePoolStats(StoragePool pool, 
GetStorageStatsCommand cmd) {
-        DataStoreProvider storeProvider = 
_dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
-        DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
         GetStorageStatsAnswer answer = null;
 
-        if (storeDriver instanceof PrimaryDataStoreDriver && 
((PrimaryDataStoreDriver)storeDriver).canProvideStorageStats()) {
-            PrimaryDataStoreDriver primaryStoreDriver = 
(PrimaryDataStoreDriver)storeDriver;
-            Pair<Long, Long> storageStats = 
primaryStoreDriver.getStorageStats(pool);
-            if (storageStats == null) {
-                answer = new GetStorageStatsAnswer((GetStorageStatsCommand) 
cmd, "Failed to get storage stats for pool: " + pool.getId());
-            } else {
-                answer = new GetStorageStatsAnswer((GetStorageStatsCommand) 
cmd, storageStats.first(), storageStats.second());
-            }
+        DataStoreProvider storeProvider = 
_dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
+        DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
+        PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) 
storeDriver;

Review comment:
       @DaanHoogland, `getStoragePoolStats` is invoked only in `sendToPool` 
(the method above), and there is a check if the datastore driver is an instance 
of PrimaryDataStoreDriver. If you want, I could add a check and here, but at 
the moment, I don't think it is needed.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to