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



##########
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 move this condition check 
`(ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() 
!= neighbor.getHypervisorType()` before getting volume locators.
   
   and use CollectionUtils for volumeLocators
   
   ```suggestion
               if (CollectionUtils.isEmpty(volumeLocators)) {
   ```




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


Reply via email to