@@ -1955,13 +1955,13 @@ public HashMap<Long, VmStatsEntry> getVirtualMachineStatistics(long hostId, Stri
19551955 }
19561956
19571957 @ Override
1958- public HashMap <String , VolumeStatsEntry > getVolumeStatistics (long clusterId , String poolUuid , StoragePoolType poolType , List < String > volumeLocators , int timeout ) {
1958+ public HashMap <String , VolumeStatsEntry > getVolumeStatistics (long clusterId , String poolUuid , StoragePoolType poolType , int timeout ) {
19591959 List <HostVO > neighbors = _resourceMgr .listHostsInClusterByStatus (clusterId , Status .Up );
19601960 StoragePoolVO storagePool = _storagePoolDao .findPoolByUUID (poolUuid );
19611961 HashMap <String , VolumeStatsEntry > volumeStatsByUuid = new HashMap <>();
19621962
19631963 for (HostVO neighbor : neighbors ) {
1964- volumeLocators = getVolumesByHost (neighbor , storagePool );
1964+ List < String > volumeLocators = getVolumesByHost (neighbor , storagePool );
19651965
19661966 // - zone wide storage for specific hypervisortypes
19671967 if ((ScopeType .ZONE .equals (storagePool .getScope ()) && storagePool .getHypervisor () != neighbor .getHypervisorType ()) || (volumeLocators == null || volumeLocators .size () == 0 )) {
@@ -1979,7 +1979,9 @@ public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, Str
19791979
19801980 if (answer instanceof GetVolumeStatsAnswer ){
19811981 GetVolumeStatsAnswer volstats = (GetVolumeStatsAnswer )answer ;
1982- volumeStatsByUuid .putAll (volstats .getVolumeStats ());
1982+ if (volstats .getVolumeStats () != null ) {
1983+ volumeStatsByUuid .putAll (volstats .getVolumeStats ());
1984+ }
19831985 }
19841986 }
19851987 return volumeStatsByUuid .size () > 0 ? volumeStatsByUuid : null ;
@@ -1988,7 +1990,8 @@ public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, Str
19881990 private List <String > getVolumesByHost (HostVO host , StoragePool pool ){
19891991 List <VMInstanceVO > vmsPerHost = _vmInstanceDao .listByHostId (host .getId ());
19901992 return vmsPerHost .stream ()
1991- .flatMap (vm -> _volsDao .findByInstanceIdAndPoolId (vm .getId (),pool .getId ()).stream ().map (vol -> vol .getState () == Volume .State .Ready ? vol .getPath () : null ).filter (Objects ::nonNull ))
1993+ .flatMap (vm -> _volsDao .findByInstanceIdAndPoolId (vm .getId (),pool .getId ()).stream ().map (vol ->
1994+ vol .getState () == Volume .State .Ready ? (vol .getFormat () == ImageFormat .OVA ? vol .getChainInfo () : vol .getPath ()) : null ).filter (Objects ::nonNull ))
19921995 .collect (Collectors .toList ());
19931996 }
19941997
0 commit comments