You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sreejasahithi (via GitHub)" <gi...@apache.org> on 2025/11/21 07:45:38 UTC

[PR] HDDS-13862. Show datanode reserved space in ozone admin datanode usageinfo command [ozone]

sreejasahithi opened a new pull request, #9338:
URL: https://github.com/apache/ozone/pull/9338

   ## What changes were proposed in this pull request?
   This change displays datanode reserved space in the output of `ozone admin datanode usageinfo` command. The datanode reports per-volume reserved bytes, SCM aggregates them across volumes, and the total reserved value is exposed via DatanodeUsageInfoProto and printed by the CLI (text and JSON).
   
   ## What is the link to the Apache JIRA
   [HDDS-13862](https://issues.apache.org/jira/browse/HDDS-13862)
   
   ## How was this patch tested?
   https://github.com/sreejasahithi/ozone/actions/runs/19536855704
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13862. Show datanode reserved space in ozone admin datanode usageinfo command [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13862. Show datanode reserved space in ozone admin datanode usageinfo command [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi merged PR #9338:
URL: https://github.com/apache/ozone/pull/9338


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13862. Show datanode reserved space in ozone admin datanode usageinfo command [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on PR #9338:
URL: https://github.com/apache/ozone/pull/9338#issuecomment-3580084588

   The JIRA server is not very slow and not responding today. Will try close the [HDDS-13862](https://issues.apache.org/jira/browse/HDDS-13862) tomorrow.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-13862. Show datanode reserved space in ozone admin datanode usageinfo command [ozone]

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on PR #9338:
URL: https://github.com/apache/ozone/pull/9338#issuecomment-3579945375

   Thanks @sreejasahithi for this improvement, and @adoroszlai for the review. 


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org