@@ -1961,26 +1961,29 @@ public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, Str
19611961 HashMap <String , VolumeStatsEntry > volumeStatsByUuid = new HashMap <>();
19621962
19631963 for (HostVO neighbor : neighbors ) {
1964- List <String > volumeLocators = getVolumesByHost (neighbor , storagePool );
19651964
19661965 // - zone wide storage for specific hypervisortypes
1967- if ((ScopeType .ZONE .equals (storagePool .getScope ()) && storagePool .getHypervisor () != neighbor .getHypervisorType ()) || ( volumeLocators == null || volumeLocators . size () == 0 ) ) {
1966+ if ((ScopeType .ZONE .equals (storagePool .getScope ()) && storagePool .getHypervisor () != neighbor .getHypervisorType ())) {
19681967 // skip this neighbour if their hypervisor type is not the same as that of the store
19691968 continue ;
19701969 }
19711970
1972- GetVolumeStatsCommand cmd = new GetVolumeStatsCommand (poolType , poolUuid , volumeLocators );
1971+ List <String > volumeLocators = getVolumesByHost (neighbor , storagePool );
1972+ if (!CollectionUtils .isEmpty (volumeLocators )) {
19731973
1974- if (timeout > 0 ) {
1975- cmd .setWait (timeout /1000 );
1976- }
1974+ GetVolumeStatsCommand cmd = new GetVolumeStatsCommand (poolType , poolUuid , volumeLocators );
19771975
1978- Answer answer = _agentMgr .easySend (neighbor .getId (), cmd );
1976+ if (timeout > 0 ) {
1977+ cmd .setWait (timeout /1000 );
1978+ }
1979+
1980+ Answer answer = _agentMgr .easySend (neighbor .getId (), cmd );
19791981
1980- if (answer instanceof GetVolumeStatsAnswer ){
1981- GetVolumeStatsAnswer volstats = (GetVolumeStatsAnswer )answer ;
1982- if (volstats .getVolumeStats () != null ) {
1983- volumeStatsByUuid .putAll (volstats .getVolumeStats ());
1982+ if (answer instanceof GetVolumeStatsAnswer ){
1983+ GetVolumeStatsAnswer volstats = (GetVolumeStatsAnswer )answer ;
1984+ if (volstats .getVolumeStats () != null ) {
1985+ volumeStatsByUuid .putAll (volstats .getVolumeStats ());
1986+ }
19841987 }
19851988 }
19861989 }
0 commit comments