You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/11 10:22:30 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4826: Allow storage plugins to get storage/volume stats without sending commands to hosts

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



##########
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:
       can this cause a class cast exception? there used to be a check for that.




-- 
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-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org