sreejasahithi commented on code in PR #9969:
URL: https://github.com/apache/ozone/pull/9969#discussion_r2980182115
##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DiskBalancerReportSubcommand.java:
##########
@@ -121,20 +164,36 @@ protected String getActionName() {
/**
* Create a JSON result map for a report.
- *
+ *
* @param report the DiskBalancer report proto
* @return JSON result map
*/
- private Map<String, Object> createReportResult(
- HddsProtos.DatanodeDiskBalancerInfoProto report) {
+ private Map<String, Object> toJson(DatanodeDiskBalancerInfoProto report) {
Map<String, Object> result = new LinkedHashMap<>();
- // Format datanode string with hostname and IP address
- String formattedDatanode = DiskBalancerSubCommandUtil.getDatanodeHostAndIp(
- report.getNode());
- result.put("datanode", formattedDatanode);
+ result.put("datanode",
DiskBalancerSubCommandUtil.getDatanodeHostAndIp(report.getNode()));
result.put("action", "report");
result.put("status", "success");
result.put("volumeDensity", report.getCurrentVolumeDensitySum());
+
+ if (report.hasIdealUsage()) {
+ result.put("idealUsage", report.getIdealUsage());
+ }
+
+ if (report.getVolumeInfoCount() > 0) {
Review Comment:
Text output includes threshold and the computed ThresholdRange, but JSON
only adds idealUsage (and per-volume rows).
--
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]