adoroszlai commented on code in PR #9338:
URL: https://github.com/apache/ozone/pull/9338#discussion_r2550142495


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/UsageInfoSubcommand.java:
##########
@@ -147,9 +147,12 @@ private void printInfo(DatanodeUsage info) {
     System.out.printf("%-24s: %s (%s) %n", "Remaining Allocatable",
         (info.getRemaining() - info.getCommitted()) + " B",
         StringUtils.byteDesc((info.getRemaining() - info.getCommitted())));
-    System.out.printf("%-24s: %s (%s) %n%n", "Free Space To Spare",
+    System.out.printf("%-24s: %s (%s) %n", "Free Space To Spare",
         info.getFreeSpaceToSpare() + " B",
         StringUtils.byteDesc(info.getFreeSpaceToSpare()));
+    System.out.printf("%-13s: %s (%s) %n%n", "Reserved",
+        info.getReserved() + " B", 
+        StringUtils.byteDesc(info.getReserved()));

Review Comment:
   Please move the extra `%n` as a `System.out.println()` at the end.  This 
will reduce future change if adding another item (like here `Free Space To 
Spare` is being changed).



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java:
##########
@@ -1023,6 +1023,15 @@ public DatanodeUsageInfo getUsageInfo(DatanodeDetails 
dn) {
     try {
       usageInfo.setContainerCount(getContainerCount(dn));
       usageInfo.setPipelineCount(getPipeLineCount(dn));
+      
+      long reserved = 0L;
+      final DatanodeInfo di = nodeStateManager.getNode(dn);
+      for (StorageReportProto r : di.getStorageReports()) {
+        if (r.hasReserved()) {
+          reserved += r.getReserved();
+        } 
+      }
+      usageInfo.setReserved(reserved);

Review Comment:
   Please create a helper function to return sum of reserved for the datanode, 
to make the abstraction level in this block more consistent.
   
   ```java
         usageInfo.setContainerCount(getContainerCount(dn));
         usageInfo.setPipelineCount(getPipeLineCount(dn));
         usageInfo.setReserved(getTotalReserved(dn));
   ```



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