devmadhuu commented on code in PR #11866:
URL: https://github.com/apache/ozone/pull/11866#discussion_r4538087890


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerBalancerAssessmentSubcommand.java:
##########
@@ -272,36 +338,62 @@ private static void 
printJsonReport(ContainerBalancerClusterSnapshot snapshot, d
     result.put("upperLimitPercentage", 
toJsonPercent(snapshot.getUpperLimit()));
     result.put("lowerLimitPercentage", 
toJsonPercent(snapshot.getLowerLimit()));
 
-    Map<String, Object> sourceNodes = new LinkedHashMap<>();
-    sourceNodes.put("count", snapshot.getSourceCount());
-    sourceNodes.put("nodes", snapshot.getTopSourceNodes().stream()
-        .map(node -> {
-          Map<String, Object> nodeMap = new LinkedHashMap<>();
-          nodeMap.put("hostname", node.getHostname());
-          nodeMap.put("utilizationPercentage", 
toJsonPercent(node.getUtilization()));
-          return nodeMap;
-        })
-        .collect(Collectors.toList()));
-    result.put("sourceNodes", sourceNodes);
-
-    Map<String, Object> targetNodes = new LinkedHashMap<>();
-    targetNodes.put("count", snapshot.getTargetCount());
-    targetNodes.put("nodes", snapshot.getBottomTargetNodes().stream()
-        .map(node -> {
-          Map<String, Object> nodeMap = new LinkedHashMap<>();
-          nodeMap.put("hostname", node.getHostname());
-          nodeMap.put("utilizationPercentage", 
toJsonPercent(node.getUtilization()));
-          return nodeMap;
-        })
-        .collect(Collectors.toList()));
-    result.put("targetNodes", targetNodes);
+    boolean typed = !snapshot.getStorageTypeSnapshots().isEmpty();
+    result.put(typed ? "sourceNodesAcrossStorageTypes" : "sourceNodes",

Review Comment:
   That makes sense. The current counts include all nodes outside their 
per-type utilization limits, while the movement estimate excludes types without 
a source/target pair. Restricting the combined counts and node lists to types 
contributing bytes to the estimate would make their meaning clearer.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to