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 2020/10/29 09:05:43 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4388: fix NPE in volumes statistics

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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1954,21 +1955,16 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI
     }
 
     @Override
-    public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, String poolUuid, StoragePoolType poolType, List<String> volumeLocators, int timeout) {
+    public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, String poolUuid, StoragePoolType poolType,  int timeout) {
         List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(clusterId, Status.Up);
         StoragePoolVO storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
-        for (HostVO neighbor : neighbors) {
-            // apply filters:
-            // - managed storage
-            // - local storage
-            if (storagePool.isManaged() || storagePool.isLocal()) {
+        HashMap<String, VolumeStatsEntry> volumeStatsByUuid = new HashMap<>();
 
-                volumeLocators = getVolumesByHost(neighbor, storagePool);
-
-            }
+        for (HostVO neighbor : neighbors) {
+            List<String> volumeLocators = getVolumesByHost(neighbor, storagePool);
 
             // - zone wide storage for specific hypervisortypes
-            if (ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() != neighbor.getHypervisorType()) {
+            if ((ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() != neighbor.getHypervisorType()) || (volumeLocators == null || volumeLocators.size() == 0)) {

Review comment:
       @slavkap yes, we will then merge forward, no problem (except maybe a conflict to resolve)




----------------------------------------------------------------
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.

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