DaanHoogland commented on code in PR #10613:
URL: https://github.com/apache/cloudstack/pull/10613#discussion_r2010555816
##########
plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java:
##########
@@ -764,14 +757,13 @@ public List<ClusterMetricsResponse>
listClusterMetrics(Pair<List<ClusterResponse
if (AllowListMetricsComputation.value()) {
List<Ternary<Long, Long, Long>> cpuList = new ArrayList<>();
List<Ternary<Long, Long, Long>> memoryList = new ArrayList<>();
- for (final Host host : hostDao.findByClusterId(clusterId)) {
- if (host == null || host.getType() != Host.Type.Routing) {
+ for (final HostJoinVO host :
hostJoinDao.findByClusterId(clusterId, Host.Type.Routing)) {
+ if (host == null) {
Review Comment:
I doubt a non null iterator will be returned that then refers a null-host.
##########
plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java:
##########
@@ -950,11 +942,11 @@ public List<ZoneMetricsResponse>
listZoneMetrics(List<ZoneResponse> zoneResponse
if (cluster == null) {
continue;
}
- for (final Host host:
hostDao.findByClusterId(cluster.getId())) {
- if (host == null || host.getType() !=
Host.Type.Routing) {
+ for (final HostJoinVO host:
hostJoinDao.findByClusterId(cluster.getId(), Host.Type.Routing)) {
+ if (host == null) {
Review Comment:
same here, I think a returned host in the list will not be null ever.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]