DaanHoogland commented on a change in pull request #3486: filter volumes by
host when refreshing stats
URL: https://github.com/apache/cloudstack/pull/3486#discussion_r305795840
##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -1904,10 +1904,21 @@ public void removeCustomOfferingDetails(long vmId) {
}
@Override
- public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long
clusterId, String poolUuid, StoragePoolType poolType, List<String>
volumeLocator, int timeout) {
+ public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long
clusterId, String poolUuid, StoragePoolType poolType, List<String>
volumeLocators, int timeout) {
List<HostVO> neighbors =
_resourceMgr.listHostsInClusterByStatus(clusterId, Status.Up);
for (HostVO neighbor : neighbors) {
- GetVolumeStatsCommand cmd = new GetVolumeStatsCommand(poolType,
poolUuid, volumeLocator);
+ StoragePool storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
+ List<String> volumeLocatorsForHost;
+ if (storagePool.isManaged()) {
+ List<UserVmVO> vmsPerHost =
_vmDao.listByHostId(neighbor.getId());
Review comment:
looks good but can you isolate the body of the if in a method like filter
hostsToQueryForVmVolumes() (and maybe add a test)? Please don't kill me but it
is kind of hard to read like this.
----------------------------------------------------------------
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]
With regards,
Apache Git Services