Skip to content

Commit f52ad0a

Browse files
committed
Replace listByZoneId in VolumeStatsTask with listClustersByDcId
1 parent cfda14d commit f52ad0a

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -931,13 +931,8 @@ protected void runInContext() {
931931

932932
for (StoragePoolVO pool : pools) {
933933
List<VolumeVO> volumes = _volsDao.findByPoolId(pool.getId(), null);
934-
List<String> volumeLocators = new ArrayList<String>();
935934
for (VolumeVO volume : volumes) {
936-
if (volume.getFormat() == ImageFormat.QCOW2 || volume.getFormat() == ImageFormat.VHD) {
937-
volumeLocators.add(volume.getPath());
938-
} else if (volume.getFormat() == ImageFormat.OVA) {
939-
volumeLocators.add(volume.getChainInfo());
940-
} else {
935+
if (volume.getFormat() != ImageFormat.QCOW2 && volume.getFormat() != ImageFormat.VHD && volume.getFormat() != ImageFormat.OVA) {
941936
s_logger.warn("Volume stats not implemented for this format type " + volume.getFormat());
942937
break;
943938
}
@@ -946,15 +941,14 @@ protected void runInContext() {
946941
Map<String, VolumeStatsEntry> volumeStatsByUuid;
947942
if (pool.getScope() == ScopeType.ZONE) {
948943
volumeStatsByUuid = new HashMap<>();
949-
for (final Cluster cluster : _clusterDao.listByZoneId(pool.getDataCenterId())) {
950-
final Map<String, VolumeStatsEntry> volumeStatsForCluster = _userVmMgr.getVolumeStatistics(cluster.getId(), pool.getUuid(), pool.getPoolType(),
951-
volumeLocators, StatsTimeout.value());
944+
for (final Cluster cluster : _clusterDao.listClustersByDcId(pool.getDataCenterId())) {
945+
final Map<String, VolumeStatsEntry> volumeStatsForCluster = _userVmMgr.getVolumeStatistics(cluster.getId(), pool.getUuid(), pool.getPoolType(), StatsTimeout.value());
952946
if (volumeStatsForCluster != null) {
953947
volumeStatsByUuid.putAll(volumeStatsForCluster);
954948
}
955949
}
956950
} else {
957-
volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), volumeLocators, StatsTimeout.value());
951+
volumeStatsByUuid = _userVmMgr.getVolumeStatistics(pool.getClusterId(), pool.getUuid(), pool.getPoolType(), StatsTimeout.value());
958952
}
959953
if (volumeStatsByUuid != null) {
960954
for (final Map.Entry<String, VolumeStatsEntry> entry : volumeStatsByUuid.entrySet()) {

0 commit comments

Comments
 (0)